Merge pull request #1374 from lcx960324/2.0
Packaging locale to dist/locale
This commit is contained in:
commit
04fb29abf4
3 changed files with 42 additions and 1 deletions
8
build/locale.js
Normal file
8
build/locale.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
const readDir = require('fs').readdirSync
|
||||||
|
const files = readDir('./src/locale/lang')
|
||||||
|
const entry = {}
|
||||||
|
files.forEach(file => {
|
||||||
|
const name = file.split('.')[0]
|
||||||
|
entry[name] = './src/locale/lang/' + file
|
||||||
|
})
|
||||||
|
module.exports = entry
|
32
build/webpack.dist.locale.config.js
Normal file
32
build/webpack.dist.locale.config.js
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
var path = require('path');
|
||||||
|
var webpack = require('webpack');
|
||||||
|
var entry = require('./locale');
|
||||||
|
process.env.NODE_ENV = 'production';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry,
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
loader: 'babel-loader',
|
||||||
|
exclude: /node_modules/
|
||||||
|
}
|
||||||
|
],
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
path: path.resolve(__dirname, '../dist/locale'),
|
||||||
|
publicPath: '/dist/locale/',
|
||||||
|
filename: '[name].js',
|
||||||
|
library: 'iview/locale',
|
||||||
|
libraryTarget: 'umd',
|
||||||
|
umdNamedDefine: true
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new webpack.DefinePlugin({
|
||||||
|
'process.env': {
|
||||||
|
NODE_ENV: '"production"'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}
|
|
@ -23,7 +23,8 @@
|
||||||
"dist:style": "gulp --gulpfile build/build-style.js",
|
"dist:style": "gulp --gulpfile build/build-style.js",
|
||||||
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
|
"dist:dev": "webpack --config build/webpack.dist.dev.config.js",
|
||||||
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
|
"dist:prod": "webpack --config build/webpack.dist.prod.config.js",
|
||||||
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod",
|
"dist:locale": "webpack --config build/webpack.dist.locale.config.js",
|
||||||
|
"dist": "npm run dist:style && npm run dist:dev && npm run dist:prod && npm run dist:locale",
|
||||||
"lint": "eslint --fix --ext .js,.vue src",
|
"lint": "eslint --fix --ext .js,.vue src",
|
||||||
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
|
"unit": "cross-env BABEL_ENV=test karma start test/unit/karma.conf.js --single-run",
|
||||||
"test": "npm run lint && npm run unit",
|
"test": "npm run lint && npm run unit",
|
||||||
|
|
Loading…
Add table
Reference in a new issue