Code splitting issue with 0.11.5
Following #1088 (closed), 0.11.5 worked for our code-base, everything is loading correctly except dynamic import (code splitting)
Code like:
case 'markup-templating':
return import('prismjs/components/prism-markup-templating.min.js');
case 'dns-zone-file':
return import('prismjs/components/prism-dns-zone-file.min.js');
case 't4-templating':
return import('prismjs/components/prism-t4-templating.min.js');
case 'markup':
return import('prismjs/components/prism-markup.min.js');
case 'docker':
return import('prismjs/components/prism-docker.min.js');
is compiled to:
and fails during import with:
Uncaught (in promise) ReferenceError: require is not defined
the configuration looks like:
const options: esbuild.BuildOptions = {
entryPoints: {
public: path.join(packagesDir, 'app-web/src/index.public.ts'),
app: path.join(packagesDir, 'app-web/src/index.ts'),
},
metafile: true,
outdir: webOutputDir,
platform: 'browser',
target: BROWSER_TARGET,
splitting: true,
format: 'esm',
resolveExtensions: WEB_EXTS,
external: [],
loader: LOADERS,
assetNames: 'assets/[name]-[hash]',
chunkNames: 'chunks/[name]-[hash]',
entryNames: isDEV ? '[name]' : '[name]-[hash]',
...esbuildOptions,
};
I'm still investigating the root cause and I'll post updates with my findings.