You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Upgrading to the latest version 4.1.0 is not compatible with *.mjs files. #59
Our project uses xlsx@0.18.5 and imports the xlsx.mjs file. However, beginning with version 4.1.0, the dependency switched to node-stdlib-browser, causing the buffer to downgrade to version 5.x. The buffer 5.x version only includes the common module, which is not compatible with the project's reference to *.mjs files, leading to webpack build errors.
Let’s see if this really is issue with buffer module, but I don’t see why not, except I would like to bump it to major version. I’m not sure if this can break other dependants.
I was able to solve the issue by setting the yaml inter-dependency version to the latest. This solved the issue of the breaking change where it could not find an index.js file. The error I was seeing was:
ERROR in ./node_modules/yaml/browser/dist/warnings-df54cb69.js 24:15-21 Module not found: Error: Can't resolve '[workspace/project]/node_modules/buffer' in '[workspace/project]/node_modules/yaml/browser/dist' Did you mean 'index.js'? BREAKING CHANGE: The request '[workspace/project]/node_modules/buffer' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, 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. resolve '[workspace/project]/node_modules/buffer' in '[workspace/project]/node_modules/yaml/browser/dist' using description file: [workspace/project]/node_modules/yaml/browser/dist/package.json (relative path: .) Field 'browser' doesn't contain a valid alias configuration root path [workspace/project] using description file: /[workspace/project]/package.json (relative path: .[workspace/project]/node_modules/buffer) Field 'browser' doesn't contain a valid alias configuration [workspace/project]/[workspace/project]/node_modules/buffer doesn't exist using description file: [workspace/project]/package.json (relative path: ./node_modules/buffer) Field 'browser' doesn't contain a valid alias configuration [workspace/project]/node_modules/buffer is not a file @ ./node_modules/yaml/browser/dist/index.js 5:0-51 978:11-15 @ ./node_modules/yaml/browser/index.js 1:0-39 @ ./node_modules/redoc/bundles/redoc.browser.lib.js 2:92854-92869 @ ./src/pages/docs/api_docs.tsx 3:0-40 14:84-99 @ ./src/AuthApp.tsx 14:0-48 28:144-151 @ ./src/App.tsx 10:0-32 19:36-43 @ ./src/index.tsx 3:0-24 6:73-76
I was able to solve it by setting this on my package.json "resolutions": { "buffer": "6.0.3", "yaml":"2.7.0" },
It seems the issue is caused by a change in how the plugin specifies the path to the buffer module.
In version v4.0.0 the ProvidePlugin was configured like this:
new webpack.ProvidePlugin({
Buffer: ['/Users/xxx/project/node_modules/buffer/index.js', 'Buffer'],
// ...
});
However, in v4.1.0, it was changed to the following:
new webpack.ProvidePlugin({
Buffer: ['/Users/xxx/project/node_modules/buffer', 'Buffer'],
// ...
});
This change seems to break module resolution for buffer.
As a workaround, adding the following rule to the webpack config allows buffer to be resolved correctly:
Activity
Richienb commentedon Dec 10, 2024
@ChrisGao2016
buffer@6.0.3also seems to use commonjs. Are you sure your issue is resolved by downgrading tonode-polyfill-webpack-plugin@4.0.0?Maybe there's a different cause?
Richienb commentedon Dec 10, 2024
@niksy Worth updating the
bufferpackage anyways?niksy commentedon Dec 10, 2024
Let’s see if this really is issue with buffer module, but I don’t see why not, except I would like to bump it to major version. I’m not sure if this can break other dependants.
gabrielbarretoo commentedon Dec 10, 2024
Same bug here. Any solution?
Rukato commentedon Jan 10, 2025
I was able to solve the issue by setting the yaml inter-dependency version to the latest. This solved the issue of the breaking change where it could not find an index.js file. The error I was seeing was:
ERROR in ./node_modules/yaml/browser/dist/warnings-df54cb69.js 24:15-21 Module not found: Error: Can't resolve '[workspace/project]/node_modules/buffer' in '[workspace/project]/node_modules/yaml/browser/dist' Did you mean 'index.js'? BREAKING CHANGE: The request '[workspace/project]/node_modules/buffer' failed to resolve only because it was resolved as fully specified (probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, 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. resolve '[workspace/project]/node_modules/buffer' in '[workspace/project]/node_modules/yaml/browser/dist' using description file: [workspace/project]/node_modules/yaml/browser/dist/package.json (relative path: .) Field 'browser' doesn't contain a valid alias configuration root path [workspace/project] using description file: /[workspace/project]/package.json (relative path: .[workspace/project]/node_modules/buffer) Field 'browser' doesn't contain a valid alias configuration [workspace/project]/[workspace/project]/node_modules/buffer doesn't exist using description file: [workspace/project]/package.json (relative path: ./node_modules/buffer) Field 'browser' doesn't contain a valid alias configuration [workspace/project]/node_modules/buffer is not a file @ ./node_modules/yaml/browser/dist/index.js 5:0-51 978:11-15 @ ./node_modules/yaml/browser/index.js 1:0-39 @ ./node_modules/redoc/bundles/redoc.browser.lib.js 2:92854-92869 @ ./src/pages/docs/api_docs.tsx 3:0-40 14:84-99 @ ./src/AuthApp.tsx 14:0-48 28:144-151 @ ./src/App.tsx 10:0-32 19:36-43 @ ./src/index.tsx 3:0-24 6:73-76I was able to solve it by setting this on my package.json
"resolutions": { "buffer": "6.0.3", "yaml":"2.7.0" },charlesritchea commentedon Feb 12, 2025
This just happened to me with axios and process. Downgrading to 4.0.0 fixed it as well
axetroy commentedon Mar 4, 2025
bufferis not a dual package, Downgrade to 4.0.0 and it works.peter-cardenas-ai commentedon Mar 17, 2025
downgrading to 4.0.0 to fix issues with rrweb worked for me
kotarella1110 commentedon May 12, 2025
It seems the issue is caused by a change in how the plugin specifies the path to the
buffermodule.In version v4.0.0 the
ProvidePluginwas configured like this:However, in v4.1.0, it was changed to the following:
This change seems to break module resolution for
buffer.As a workaround, adding the following rule to the webpack config allows
bufferto be resolved correctly:ChrisGao2016 commentedon May 14, 2025
It seems that way.