-
Notifications
You must be signed in to change notification settings - Fork 43
/
lib.webpack.config.js
53 lines (52 loc) · 1.44 KB
/
lib.webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
var path = require('path'); // eslint-disable-line no-var
var ExtractTextPlugin = require('extract-text-webpack-plugin'); // eslint-disable-line no-var
var autoprefixer = require('autoprefixer'); // eslint-disable-line no-var
module.exports = {
output: {
// for babel plugin
libraryTarget: 'commonjs2',
// where to place webpack files
path: path.join(__dirname, '../build/myCoolLibrary/assets'),
// for url-loader if limit exceeded to set publicPath
publicPath: '/assets/',
},
plugins: [
new ExtractTextPlugin(path.parse(process.argv[2]).name + '.css'),
],
postcss: [
autoprefixer({ browsers: ['last 2 versions'] }),
],
module: {
loaders: [
{
test: /\.sass$/,
loader: ExtractTextPlugin.extract(
'style-loader',
[
'css-loader?modules&importLoaders=2&localIdentName=[name]__[local]--[hash:base64:5]',
'postcss-loader',
`sass-loader?precision=10&indentedSyntax=sass`,
]
),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract(
'style-loader',
[
'css-loader?modules&importLoaders=2&localIdentName=[name]__[local]--[hash:base64:5]',
'postcss-loader',
]
),
},
{
test: /\.png$/,
loaders: ['url-loader?limit=7000'],
},
{
test: /\.txt$/,
loaders: ['file-loader'],
},
],
},
};