Skip to content

Commit

Permalink
Upgrade to Webpack 2
Browse files Browse the repository at this point in the history
  • Loading branch information
francoischalifour committed Mar 4, 2017
1 parent 127a76d commit 22425d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@
"rimraf": "^2.6.1",
"standard": "^9.0.0",
"style-loader": "^0.13.2",
"webpack": "^2.2.1"
}
}
28 changes: 19 additions & 9 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const path = require('path')
const webpack = require('webpack')

const autoprefixer = require('autoprefixer')

const pkg = require('./package.json')
Expand All @@ -19,10 +18,18 @@ const banner = `

let outputFile

plugins.push(new webpack.BannerPlugin(banner))
plugins.push(new webpack.BannerPlugin({ banner }))
plugins.push(new webpack.LoaderOptionsPlugin({
options: {
postcss: [autoprefixer]
}
}))

if (env === 'build') {
plugins.push(new webpack.optimize.UglifyJsPlugin({ minimize: true, compress: { warnings: false } }))
plugins.push(new webpack.optimize.UglifyJsPlugin({
minimize: true,
sourceMap: true
}))
outputFile = `${libraryName}.min.js`
} else {
outputFile = `${libraryName}.js`
Expand All @@ -39,22 +46,25 @@ module.exports = {
umdNamedDefine: true
},
module: {
loaders: [
rules: [
{
test: /\.js$/,
loader: 'babel',
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
loader: 'style-loader!css-loader!postcss-loader'
use: [
'style-loader',
'css-loader',
'postcss-loader'
]
}
]
},
plugins,
postcss: () => [ autoprefixer ],
resolve: {
root: path.resolve('./src'),
extensions: ['', '.js']
modules: [path.resolve('./src')],
extensions: ['.js']
}
}

0 comments on commit 22425d2

Please sign in to comment.