Skip to content
File

Blob: samples/module_fallback/worker.js

javascript26 lines
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 
5import * as foo from 'foo';
6import * as baz from 'baz';
7import * as vm from 'node:vm';
8import { strictEqual } from 'node:assert';
9import * as cjs from 'cjs';
10 
11try {
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 
18console.log(foo, baz, vm);
19 
20export default {
21 async fetch(req, env) {
22 strictEqual(1 + 1, 2);
23 return new Response("Hello World\n");
24 }
25};