Skip to content

Commit

Permalink
remove redundant js
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslcj committed Nov 22, 2018
1 parent c077c38 commit 5f4e149
Show file tree
Hide file tree
Showing 180 changed files with 13,156 additions and 512,897 deletions.
3 changes: 2 additions & 1 deletion console/src/main/resources/static/console-fe/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.ejs
.DS_Store
build
node_modules
node_modules
public
3 changes: 2 additions & 1 deletion console/src/main/resources/static/console-fe/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.ejs
.DS_Store
build
node_modules
node_modules
public
42 changes: 42 additions & 0 deletions console/src/main/resources/static/console-fe/build/copyFile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 1999-2018 Alibaba Group Holding Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const fs = require('fs');
const path = require('path');
// 默认打包存放地址
const srcDir = path.join(__dirname, '../dist');
// 打包后文件存放地址
const destDir = path.join(__dirname, '../../');

const mkdir = dir => {
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
};

const copyList = ['js/main.js', 'css/main.css'];

copyList.forEach(_fileName => {
const srcFileName = path.join(srcDir, _fileName);
const destFileName = path.join(destDir, _fileName);

if (!fs.existsSync(srcFileName)) {
return;
}

mkdir(path.dirname(destFileName));

const readStream = fs.createReadStream(srcFileName);
const writeStream = fs.createWriteStream(destFileName);
readStream.pipe(writeStream);
});
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ module.exports = {
main: './src/index.js',
},
output: {
filename: './js/[name].[chunkhash:8].js',
filename: './js/[name].js',
path: path.resolve(__dirname, '../dist'),
},
resolve: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = Object.assign({}, base, {
}),
...base.plugins,
new MiniCssExtractPlugin({
filename: './css/[name].[hash:8].css',
filename: './css/[name].css',
chunkFilename: '[id].css',
}),
],
Expand Down
2 changes: 1 addition & 1 deletion console/src/main/resources/static/console-fe/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "cross-env NODE_ENV=development webpack-dev-server --config build/webpack.dev.conf.js",
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.conf.js && node build/copy-dist.js",
"build": "cross-env NODE_ENV=production webpack --config build/webpack.prod.conf.js && node build/copyFile.js",
"eslint": "eslint --ext .js src/",
"eslint-fix": "eslint --ext .js --fix src/"
},
Expand Down
Loading

0 comments on commit 5f4e149

Please sign in to comment.