Skip to content

Commit 8b6da97

Browse files
committed
make build
1 parent 3d4bba8 commit 8b6da97

8 files changed

+467
-38
lines changed

.babelrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"presets": ["es2015", "stage-2"],
3+
"plugins": ["transform-runtime"],
4+
"comments": false
5+
}

.eslintignore

Whitespace-only changes.

.eslintrc.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = {
2+
root: true,
3+
parserOptions: {
4+
sourceType: 'module'
5+
},
6+
7+
extends: 'standard',
8+
// required to lint *.vue files
9+
plugins: [
10+
'html'
11+
]
12+
}

dist/vuex-loading.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+12-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"bugs": {
2020
"url": "https://github.com/f/vuex-loading/issues"
2121
},
22-
"main": "src/vue-loading.js",
22+
"main": "dist/vuex-loading.js",
2323
"files": [
2424
"src",
2525
"LICENSE",
@@ -28,6 +28,7 @@
2828
"scripts": {
2929
"test": "exit 0;",
3030
"precommit": "lint-staged",
31+
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules",
3132
"dev-vuex": "poi examples/vuex-example/index.js",
3233
"dev-default": "poi examples/default-example/index.js"
3334
},
@@ -42,13 +43,22 @@
4243
]
4344
},
4445
"devDependencies": {
46+
"babel-core": "^6.26.0",
47+
"babel-loader": "^7.1.2",
48+
"babel-plugin-transform-runtime": "^6.23.0",
49+
"babel-preset-es2015": "^6.24.1",
50+
"babel-preset-stage-0": "^6.24.1",
51+
"cross-env": "^5.1.3",
4552
"eslint": "^4.2.0",
4653
"husky": "^0.14.3",
4754
"lint-staged": "^4.0.1",
4855
"poi": "^9.5.4",
4956
"prettier": "^1.1.0",
5057
"vue": "^2.0.0",
51-
"vuex": "^3.0.1"
58+
"vue-html-loader": "^1.2.4",
59+
"vue-loader": "^13.7.0",
60+
"vuex": "^3.0.1",
61+
"webpack": "^3.10.0"
5262
},
5363
"peerDependencies": {
5464
"vue": "^2.0.0"

src/vue-loading.js src/vuex-loading.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import vLoading from './v-loading.vue';
22

3-
export let _Vue;
4-
53
const mutations = {
64
LOAD: 'LOAD',
75
END: 'END'
@@ -153,15 +151,14 @@ export default class VueLoading {
153151
}
154152

155153
export function install(Vue) {
156-
if (install.installed && _Vue && Vue === _Vue) {
154+
if (install.installed && Vue) {
157155
if (process.env.NODE_ENV !== 'production') {
158156
console.warn(
159-
'[vue-loading] already installed. Vue.use(VueLoading) should be called only once.'
157+
'[vuex-loading] already installed. Vue.use(VuexLoading) should be called only once.'
160158
);
161159
}
162160
return;
163161
}
164-
_Vue = Vue;
165162
install.installed = true;
166163
// applyMixin
167164
Vue.mixin({

webpack.config.js

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
var path = require('path')
2+
var webpack = require('webpack')
3+
4+
module.exports = {
5+
entry: './src/vuex-loading.js',
6+
output: {
7+
path: path.resolve(__dirname, './dist'),
8+
publicPath: '/dist/',
9+
filename: 'vuex-loading.min.js',
10+
library: 'VuexLoading',
11+
libraryTarget: 'umd',
12+
umdNamedDefine: true
13+
},
14+
15+
module: {
16+
loaders: [
17+
{
18+
test: /\.vue$/,
19+
loader: 'vue-loader'
20+
},
21+
{
22+
test: /\.js$/,
23+
loader: 'babel-loader',
24+
exclude: /node_modules/
25+
}
26+
]
27+
},
28+
devtool: '#eval-source-map'
29+
}
30+
31+
if (process.env.NODE_ENV === 'production') {
32+
module.exports.devtool = false
33+
module.exports.plugins = (module.exports.plugins || []).concat([
34+
new webpack.DefinePlugin({
35+
'process.env': {
36+
NODE_ENV: '"production"'
37+
}
38+
}),
39+
new webpack.optimize.UglifyJsPlugin({
40+
compress: {
41+
warnings: false
42+
},
43+
sourceMap: false
44+
}),
45+
])
46+
}

0 commit comments

Comments
 (0)