File
Blob: samples/module_fallback/worker.js
| 1 | // Copyright (c) 2017-2023 Cloudflare, Inc. |
| 2 | // Licensed under the Apache 2.0 license found in the LICENSE file or at: |
| 3 | // https://opensource.org/licenses/Apache-2.0 |
| 4 | |
| 5 | import * as foo from 'foo'; |
| 6 | import * as baz from 'baz'; |
| 7 | import * as vm from 'node:vm'; |
| 8 | import { strictEqual } from 'node:assert'; |
| 9 | import * as cjs from 'cjs'; |
| 10 | |
| 11 | try { |
| 12 | await import('bar'); |
| 13 | throw new Error('bar should not have been imported'); |
| 14 | } catch { |
| 15 | console.log('tried to import bar which does not exist'); |
| 16 | }; |
| 17 | |
| 18 | console.log(foo, baz, vm); |
| 19 | |
| 20 | export default { |
| 21 | async fetch(req, env) { |
| 22 | strictEqual(1 + 1, 2); |
| 23 | return new Response("Hello World\n"); |
| 24 | } |
| 25 | }; |