-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,48 @@ const merge = require('webpack-merge'); | |
const defaults = require('./webpack.defaults.js'); | ||
const packageConfig = require('./packageConfig'); | ||
|
||
module.exports = merge.smart({ | ||
module: { | ||
rules: [{ | ||
test: /\.css$/, | ||
use: [path.join(__dirname, '../lib/exportLocalsLoader.js')], | ||
}, { | ||
test: /\.scss$/, | ||
use: [path.join(__dirname, '../lib/exportLocalsLoader.js')], | ||
}], | ||
}, | ||
}, defaults, { | ||
const config = merge.smart(defaults, { | ||
target: 'node', | ||
mode: 'production', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.css$/, | ||
include: path.resolve('src'), | ||
use: [ | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
exportOnlyLocals: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.css$/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. no, we need different config for the |
||
include: path.resolve('node_modules'), | ||
use: [ | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
exportOnlyLocals: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
{ | ||
test: /\.scss$/, | ||
use: [ | ||
{ | ||
loader: 'css-loader', | ||
options: { | ||
exportOnlyLocals: true, | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
node: { | ||
console: false, | ||
global: false, | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. without this, the node server is trying to |
||
})], | ||
plugins: [ | ||
new webpack.BannerPlugin({ | ||
banner: 'require("source-map-support").install();', | ||
|
@@ -45,3 +76,5 @@ module.exports = merge.smart({ | |
], | ||
devtool: 'source-map', | ||
}); | ||
|
||
module.exports = config; |
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
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 thisnodeExternals
, i guess since this thing returns a function. so this is repeated