diff --git a/src/build/stable/commands/compile/javascript.ts b/src/build/stable/commands/compile/javascript.ts index a232601778..63072d9252 100644 --- a/src/build/stable/commands/compile/javascript.ts +++ b/src/build/stable/commands/compile/javascript.ts @@ -79,7 +79,7 @@ export function getBuildOptions(ts: string): BuildOptions { setup(build): void { build.onResolve( { - filter: /^internal$|^util$|^fs$|^fmt$|^assert$|^buffer$|^path$|^stream$|^process$|^url$|^events$|^string_decoder$|^punycode$|^querystring$|^whatwg_url$|^encoding$|^http$|^os$|^crypto$|^zlib$|^internal\/deps\/acorn\/acorn\/dist\/acorn$|^internal\/deps\/acorn\/acorn-walk\/dist\/walk$|^perf_hooks$|^async_hooks$|^https$|^_node:fs$|^_node:os$|^_node:crypto$|^qjs:os$|^_encoding$|^wasi_net$|^wasi_http$/ + filter: /^internal$|^util$|^fs$|^fs\/promises$|^fmt$|^assert$|^buffer$|^path$|^stream$|^process$|^url$|^events$|^string_decoder$|^punycode$|^querystring$|^whatwg_url$|^encoding$|^http$|^os$|^crypto$|^zlib$|^internal\/deps\/acorn\/acorn\/dist\/acorn$|^internal\/deps\/acorn\/acorn-walk\/dist\/walk$|^perf_hooks$|^async_hooks$|^https$|^_node:fs$|^_node:os$|^_node:crypto$|^qjs:os$|^_encoding$|^wasi_net$|^wasi_http$/ }, (args) => { throw new Error(experimentalMessage(args.path)); diff --git a/src/lib/experimental/experimental.ts b/src/lib/experimental/experimental.ts index 51e66dedcf..7d5504eb89 100644 --- a/src/lib/experimental/experimental.ts +++ b/src/lib/experimental/experimental.ts @@ -1,23 +1,9 @@ if (globalThis._azleExperimental !== true) { - const importName = getImportName(); - - throw new Error(experimentalMessage(importName)); -} - -function getImportName(): string { - if (import.meta.url.includes('azle/src/lib/experimental')) { - return 'azle/experimental'; - } - - throw new Error( - `Azle: Experimental import name for module path ${ - import.meta.url - } has not been created` - ); + throw new Error(experimentalMessage()); } -function experimentalMessage(importName: string): string { - return `Azle: experimental mode must be enabled to import from ${importName}. You can enable experimental mode in your dfx.json file like this: +function experimentalMessage(): string { + return `Azle: experimental mode must be enabled to import from azle/experimental. You can enable experimental mode in your dfx.json file like this: { "canisters": { "canisterName": {