Skip to content

Commit b2f0a5b

Browse files
committed
✨ Add minimal release webpack config without minimize and without production tags
1 parent 2a1377c commit b2f0a5b

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

build/webpack.release.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
var vue = require('vue-loader')
2+
var path = require('path')
3+
var webpack = require("webpack")
4+
var ExtractTextPlugin = require("extract-text-webpack-plugin")
5+
var projectRoot = path.resolve(__dirname, '../')
6+
var cssLoader = ExtractTextPlugin.extract('style-loader', 'css-loader')
7+
8+
module.exports = {
9+
entry: {
10+
'vue-chartjs': './src/index.js'
11+
},
12+
output: {
13+
filename: './dist/[name].js',
14+
library: 'VueChartJs',
15+
libraryTarget: 'umd'
16+
},
17+
module: {
18+
preLoaders: [
19+
{
20+
test: /\.vue$/,
21+
loader: 'eslint',
22+
include: projectRoot,
23+
exclude: /node_modules/
24+
},
25+
{
26+
test: /\.js$/,
27+
loader: 'eslint',
28+
include: projectRoot,
29+
exclude: /node_modules/
30+
}
31+
],
32+
loaders: [
33+
{
34+
test: /\.vue$/,
35+
loader: 'vue'
36+
},
37+
{
38+
test: /\.js$/,
39+
exclude: /node_modules/,
40+
loader: 'babel'
41+
},
42+
{
43+
test: /\.css$/,
44+
loader: cssLoader
45+
},
46+
{
47+
test: /\.s[a|c]ss$/,
48+
loader: ExtractTextPlugin.extract('style-loader','css-loader!sass-loader')
49+
}
50+
]
51+
},
52+
eslint: {
53+
formatter: require('eslint-friendly-formatter')
54+
},
55+
babel: {
56+
presets: ['es2015'],
57+
plugins: ['transform-runtime']
58+
}
59+
}
60+
61+
if (process.env.NODE_ENV === 'production') {
62+
63+
delete module.exports.devtool
64+
module.exports.plugins = [
65+
new webpack.DefinePlugin({
66+
'process.env': {
67+
NODE_ENV: '"production"'
68+
}
69+
}),
70+
new webpack.optimize.UglifyJsPlugin({
71+
compress: {
72+
warnings: false
73+
}
74+
}),
75+
new webpack.optimize.OccurenceOrderPlugin()
76+
// new ExtractTextPlugin('build.css')
77+
]
78+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"e2e": "node test/e2e/runner.js",
2323
"test": "npm run unit",
2424
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs",
25+
"release": "webpack --progress --hide-modules --config ./build/webpack.release.js",
2526
"prepublish": "node build/build.js"
2627
},
2728
"dependencies": {

0 commit comments

Comments
 (0)