Skip to content

Commit

Permalink
Upgrades webpack to v2 (#1)
Browse files Browse the repository at this point in the history
* Upgrading webpack to v2
  • Loading branch information
kafkahw authored Jun 15, 2017
1 parent f158d8e commit b3fd427
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 43 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"build": "npm run test && npm run clean && npm run lint-js && npm run build-es5 && npm run build-webpack",
"build-doc": "jsdoc --package package.json -d doc ./src/**/*.js",
"build-es5": "babel src --out-dir lib ",
"build-webpack": "webpack --progress --colors --display-error-details",
"build-webpack": "webpack -p --progress --colors --display-error-details",
"clean": "rm -rf dist lib doc",
"dev": "webpack-dev-server --host=0.0.0.0 --inline --config webpack.config.dev.js",
"dev": "webpack-dev-server --config webpack.config.dev.js",
"lint-js": "eslint 'src/**/*.js' --fix",
"test": "mocha --compilers js:babel-core/register --recursive"
},
Expand All @@ -41,8 +41,8 @@
"matchdep": "^1.0.1",
"mocha": "^3.1.0",
"sinon": "^1.17.6",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
"webpack": "^2.5.1",
"webpack-dev-server": "^2.4.5"
},
"repository": {
"type": "git",
Expand Down
37 changes: 20 additions & 17 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,32 @@
var path = require("path"),
webpack = require("webpack"),
pkg = require("./package.json");
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');

module.exports = {
entry: {
"xfc": ["babel-polyfill", "./src"],
xfc: ['babel-polyfill', './src'],
},
output: {
path: "./dist/",
filename: "xfc.js",
filename: 'xfc.js',
libraryTarget: 'umd',
library: 'XFC'
library: 'XFC',
},
module: {
loaders: [
rules: [
{
test: /\.js$/,
include: /src|index\.js/,
loader: 'babel-loader',
query: {
presets: ["es2015"],
}
}
]
include: path.resolve(__dirname, 'src'),
use: [
{
loader: 'babel-loader',
},
],
},
],
},
devtool: "sourcemap",
debug: true
devServer: {
host: '0.0.0.0',
disableHostCheck: true,
},
devtool: 'cheap-eval-source-map',
};
39 changes: 17 additions & 22 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,29 @@
var path = require("path"),
webpack = require("webpack"),
pkg = require("./package.json");
const path = require('path');
const webpack = require('webpack');
const pkg = require('./package.json');

module.exports = {
entry: {
"xfc": ["./src"],
xfc: ['./src'],
},
output: {
path: "./dist/",
filename: "xfc.js",
path: path.resolve(__dirname, 'dist'),
filename: 'xfc.js',
libraryTarget: 'umd',
library: 'XFC'
library: 'XFC',
},
module: {
loaders: [
rules: [
{
test: /\.js$/,
include: /src|index\.js/,
loader: 'babel-loader',
query: {
presets: ["es2015"],
}
}
]
include: path.resolve(__dirname, 'src'),
use: [
{
loader: 'babel-loader',
},
],
},
],
},
devtool: "sourcemap",
plugins: [
new webpack.optimize.DedupePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin()
]
devtool: 'source-map',
};

0 comments on commit b3fd427

Please sign in to comment.