-
-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to use yaml lib with webpack 5 #208
Comments
I have the same problem here. |
Huh, looks like Webpack 5 cares about the package.json { test: /\.js$/, type: 'javascript/auto' } If you'd prefer to make the test really specific, use Edit: Fixed specific regexp to grab all of |
@eemeli thanks. But more specific, as I understand, exclude does not work. |
👍
I'm sorry, I don't think I quite understood what you meant here? |
I thought you suggest to add {
test: /node_modules\/yaml\/browser\/dist\/.*/,
type: 'javascript/auto',
use: {
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
],
},
},
} Thanks |
@eemeli Confirmed this works! Thanks for the solution! |
@eemeli I think there's still a problem here...
|
@jedwards1211 Are you getting an error with Webpack 5 when using the And you're right, you can't |
What I mean is I think if you make both files use the same source type, whether it's module or script, we wouldn't need |
Okay I was experimenting with the installed
Webpack 5 still complains To make matters worse Webpack 5 doesn't seem to interpret the condition-then-path style of nesting correctly:
This is a valid way of declaring conditional exports for Node at least according to https://nodejs.org/api/packages.html#packages_nested_conditions |
Actually I was wrong, things have gotten too complicated 😭 Top level conditions are apparently only valid when there are no subpath exports:
|
Okay, sorry for all the messages but I'm slowly figuring this out. The problem is I had assumed that the It seems like the best thing would be to use Or you could output all CommonJS modules in |
As an experiment, could you apply locally the fix of bc4929c, which was the commit that closed this issue? As in, leave the root { "type": "module" } |
Ah I didn't notice that commit. That would probably work for the root import, but it wouldn't work for some subpath imports because some of the files in |
Huh, I'd forgotten about Will need to think of a solution for those files as well, and properly look at how Webpack 5 handles things. |
Okay I looked through #163 and the code, looks like you've changed the export structure in I think this would work:
|
This solution was suggested by @jedwards1211 in #208
This solution was suggested by @jedwards1211 in #208
Got an error during
webpack server
command. And I can't figure out what I do wrong. If possible could you please help?Webpack config:
package.json
index.js
The text was updated successfully, but these errors were encountered: