added source map and made lib directory visible for bower deployment #3

This commit is contained in:
Camel Aissani 2016-09-12 00:40:45 +02:00
parent 2702bb8ff6
commit 6659ca98b7
6 changed files with 27 additions and 28 deletions

View File

@ -1,4 +1,5 @@
frontexpress.js
frontexpress.min.js
frontexpress.min.js.map
coverage
dist

View File

@ -1,5 +1,6 @@
index.js
frontexpress.js
frontexpress.min.js
frontexpress.min.js.map
test
coverage

View File

@ -22,7 +22,6 @@
"**/.*",
"index.js",
"webpack.config.babel.js",
"lib",
"node_modules",
"bower_components",
"test",

3
frontexpress.min.js vendored

File diff suppressed because one or more lines are too long

1
frontexpress.min.js.map Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,33 +1,29 @@
import webpack from 'webpack';
import path from 'path';
const entry = path.join(__dirname, 'index.js');
const module = {
loaders: [{
test: /\.js/,
loader: 'babel-loader'
}]
};
const output = (min=false) => {
const filename = min?'frontexpress.min.js':'frontexpress.js';
const script = (name, min=false) => {
return {
path: __dirname,
filename
entry: path.join(__dirname, 'index.js'),
output: {
path: __dirname,
filename: min?`${name}.min.js`:`${name}.js`
},
devtool: min?'source-map':null,
module: {
loaders: [{
test: /\.js/,
loader: 'babel-loader'
}]
},
plugins: !min?[]:[
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin(),
],
};
};
export default [{
entry,
output: output(true),
module,
plugins: [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin(),
],
},
{
entry,
output: output(),
module
}];
export default [
script('frontexpress'),
script('frontexpress', true)
];