Replies: 1 comment
-
Also, I can confirm that changing ...pre.map((include) => `require(${stringifyRequest(include)});`),
`module.exports = require(${stringifyRequest(`!!${remainingRequest}`)});`,
...post.map((include) => `require(${stringifyRequest(include)});`) to ...pre.map((include) => `import(${stringifyRequest(include)});`),
`import * as xxx from ${stringifyRequest(`!!${remainingRequest}`)};`,
`export default xxx;`,
...post.map((include) => `import(${stringifyRequest(include)});`) inside |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Reproducible in vscode.dev or in VS Code Desktop?
Reproducible in the monaco editor playground?
Monaco Editor Playground Code
No response
Actual Behavior
Steps to reproduce:
cd samples/browser-esm-webpack-monaco-plugin
file.js
with one lineexport * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
inindex.js
withimport { monaco } from './file';
NODE_ENV=production npm run build
Result:
dist/main.bundle.js
should contain_common_network_js__WEBPACK_IMPORTED_MODULE_8__/* .RemoteAuthorities.setPreferredWebSchema */ .WX.setPreferredWebSchema(/^https:/.test(window.location.href) ? 'https' : 'http');
but instead it has
/* unused export .RemoteAuthorities.setPreferredWebSchema */ undefined(/^https:/.test(window.location.href) ? 'https' : 'http');
which cause a runtime error (you can open
dist/index.html
in browser to see)You can switch between the old line in index.js and the new one to see the difference.
Works similar in development mode.
Expected Behavior
Shouldn't exclude used exports
Additional Context
It's not the webpack bug webpack/webpack#15346
Beta Was this translation helpful? Give feedback.
All reactions