-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
42 lines (40 loc) · 1006 Bytes
/
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
const autoprefixer = require('autoprefixer')
const precss = require('precss')
const ExtractTextPlugin = require("extract-text-webpack-plugin")
const fs = require('fs')
var entries = {'react-rtab': './src/index.js'}
fs.readdirSync("themes").forEach((fileName) => {
var regex = /(.+)\.pcss$/
if (regex.test(fileName)) {
var name = regex.exec(fileName)[1]
entries[name] = './themes/' + fileName
}
})
module.exports = {
entry: entries,
output: {
filename: 'react-rtab.js',
path: './dist',
library: true,
libraryTarget: 'commonjs2'
},
module: {
loaders: [
{test: /\.js$/, loader: 'babel-loader'},
{test: /\.pcss$/, loader: ExtractTextPlugin.extract('style-loader','css-loader!postcss-loader')},
]
},
resolve: {
extensions: ['', '.js', '.pcss']
},
plugins: [
new ExtractTextPlugin("[name].css")
],
externals: {
react: "react",
classnames: "classnames"
},
postcss: function () {
return [autoprefixer, precss];
}
};