I don't know how to load with webpack any CSS from node_modules libs, for example I've installed leaflet and each attempt of load leaflet/dist/leaflet.css
fails.
Could you provide example how to load static styles from node_modules?
My current webpack config below. Additionaly I'm using extract-text-webpack-plugin
and sass-loader
my project scss files are working well, I have also css-loader
, have I to resolve static css files or add something to stylePathResolves
?
//require('leaflet/dist/leaflet.css');
var ExtractTextPlugin = require(extract-text-webpack-plugin);
var webpack = require(webpack);
var path = require('path');
var stylePathResolves = (
'includePaths[]=' + path.resolve('./') + '&' +
'includePaths[]=' + path.resolve('./node_modules')
)
module.exports = {
entry: .js/app.js,
output: {
path: ./static/js,
filename: app.js
},
module: {
loaders: [{
test: /.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
}, {
test: /.scss$/,
loader: ExtractTextPlugin.extract(
'style',
'css' + '!sass?outputStyle=expanded&' + stylePathResolves
)
}
]
},
plugins: [new ExtractTextPlugin(app.css)]
};
Where to load leaflet.css, commented out require('leaflet/dist/leaflet.css')
gives me following error:
home/myproj/node_modules/leaflet/dist/leaflet.css:3
.leaflet-map-pane,
^
SyntaxError: Unexpected token .