ERROR in ./node_modules/my-module/index.js 2:28-34
Module not found: Error: Can't resolve 'global/window' in './node_modules/my-module'
Did you mean 'window.js'?
BREAKING CHANGE: The request 'global/window' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '*.mjs' file or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.
This appears to be because global/window is not a valid identifier in ES modules so every single example on the web fails:
new webpack.ProvidePlugin({
window: "global/window",
document: "global/document",
}),
Thankfully in this case the solution was:
new webpack.ProvidePlugin({
window: "global/window.js",
document: "global/document.js",
}),
This might be fixable with export maps in package.json, but I'm not entirely sure.
This appears to be because
global/windowis not a valid identifier in ES modules so every single example on the web fails:Thankfully in this case the solution was:
This might be fixable with
exportmaps in package.json, but I'm not entirely sure.