-
Notifications
You must be signed in to change notification settings - Fork 25
fix loading css files from node_modules; use new exportOnlyLocals #54
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
Conversation
@@ -34,7 +63,9 @@ module.exports = merge.smart({ | |||
path: path.resolve('build'), | |||
}, | |||
// put all node_modules into externals (require() them as usual w/o webpack) | |||
externals: [nodeExternals()], | |||
externals: [nodeExternals({ | |||
whitelist: /\.css$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without this, the node server is trying to require()
css files
@@ -8,10 +8,10 @@ module.exports = Object.assign({}, defaults, { | |||
entry: ['webpack/hot/poll?1000'].concat(defaults.entry), | |||
watch: true, | |||
externals: [nodeExternals({ | |||
whitelist: ['webpack/hot/poll?1000'], | |||
whitelist: ['webpack/hot/poll?1000', /\.css$/], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merge.smart
doesn't seem to handle this nodeExternals
, i guess since this thing returns a function. so this is repeated
const req = loaderUtils.stringifyRequest(this, `!!${remainingRequest}`); | ||
return `var content = require(${req}); | ||
|
||
if (content.locals) module.exports = content.locals;`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer needed since this is natively supported in css-loader
now! 🎉
], | ||
}, | ||
{ | ||
test: /\.css$/, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can these two css tests be merged to one if we pass an array of paths to include?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, we need different config for the node_modules
paths. the src
paths use our old postcss pipeline as well as modules
, so classnames in external packages were transformed to something like .___node_modules____foo-bar-baz
No description provided.