Commit 7b3a08dc by chenyu

update: update

parent 2ef71635
{ {
"presets": [ "presets": [
["env", { [
"modules": false, "@babel/preset-env",
"targets": { {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"] "useBuiltIns": "usage",
"corejs": "2",
"targets": {
"browsers": ["> 1%", "last 2 versions", "not ie <= 8"]
}
} }
}], ],
"stage-2" "@vue/babel-preset-jsx"
], ]
"plugins": ["transform-vue-jsx", "transform-runtime"]
} }
.DS_Store
node_modules/
/build/
/config/
/dist/ /dist/
/*.js /node_modules/
/static/
/**/assets/
node_modules/* .DS_Store
.idea node_modules/
*.idea npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx --no-install commitlint --edit "$1"
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npx lint-staged
...@@ -4,7 +4,6 @@ module.exports = { ...@@ -4,7 +4,6 @@ module.exports = {
"plugins": { "plugins": {
"postcss-import": {}, "postcss-import": {},
"postcss-url": {}, "postcss-url": {},
// to edit target browsers: use "browserslist" field in package.json
"autoprefixer": {} "autoprefixer": {}
} }
} }
# y
> A Vue.js project
## Build Setup - 在项目根目录中使用node命令执行exec.js文件路径
- 修改config/index.js中的publicpath为当前项目名
``` bash - 删除node_modules文件夹重新 npm install
# install dependencies - 执行npm run lint校验代码
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
```
For a detailed explanation on how things work, check out the [guide](http://vuejs-templates.github.io/webpack/) and [docs for vue-loader](http://vuejs.github.io/vue-loader).
'use strict' 'use strict';
require('./check-versions')() require('./check-versions')();
process.env.NODE_ENV = 'production' process.env.NODE_ENV = 'production';
const ora = require('ora') const ora = require('ora');
const rm = require('rimraf') const chalk = require('chalk');
const path = require('path') const webpack = require('webpack');
const chalk = require('chalk') const webpackConfig = require('./webpack.prod.conf');
const webpack = require('webpack')
const config = require('../config')
const webpackConfig = require('./webpack.prod.conf')
const spinner = ora('building for production...') const spinner = ora('building for production...');
spinner.start() spinner.start();
rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { webpack(webpackConfig, (err, stats) => {
if (err) throw err spinner.stop();
webpack(webpackConfig, (err, stats) => { if (err) throw err;
spinner.stop() process.stdout.write(stats.toString({
if (err) throw err colors: true,
process.stdout.write(stats.toString({ modules: false,
colors: true, children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build.
modules: false, chunks: false,
children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. chunkModules: false,
chunks: false, }) + '\n\n');
chunkModules: false
}) + '\n\n')
if (stats.hasErrors()) { if (stats.hasErrors()) {
console.log(chalk.red(' Build failed with errors.\n')) console.log(chalk.red(' Build failed with errors.\n'));
process.exit(1) process.exit(1);
} }
console.log(chalk.cyan(' Build complete.\n')) console.log(chalk.cyan(' Build complete.\n'));
console.log(chalk.yellow( console.log(chalk.yellow(
' Tip: built files are meant to be served over an HTTP server.\n' + ' Tip: built files are meant to be served over an HTTP server.\n' +
' Opening index.html over file:// won\'t work.\n' ' Opening index.html over file:// won\'t work.\n',
)) ));
}) });
})
'use strict' 'use strict';
const chalk = require('chalk') const chalk = require('chalk');
const semver = require('semver') const semver = require('semver');
const packageConfig = require('../package.json') const packageConfig = require('../package.json');
const shell = require('shelljs') const shell = require('shelljs');
function exec (cmd) { function exec (cmd) {
return require('child_process').execSync(cmd).toString().trim() return require('child_process').execSync(cmd).toString().trim();
} }
const versionRequirements = [ const versionRequirements = [
{ {
name: 'node', name: 'node',
currentVersion: semver.clean(process.version), currentVersion: semver.clean(process.version),
versionRequirement: packageConfig.engines.node versionRequirement: packageConfig.engines.node,
} },
] ];
if (shell.which('npm')) { if (shell.which('npm')) {
versionRequirements.push({ versionRequirements.push({
name: 'npm', name: 'npm',
currentVersion: exec('npm --version'), currentVersion: exec('npm --version'),
versionRequirement: packageConfig.engines.npm versionRequirement: packageConfig.engines.npm,
}) });
} }
module.exports = function () { module.exports = function () {
const warnings = [] const warnings = [];
for (let i = 0; i < versionRequirements.length; i++) { for (let i = 0; i < versionRequirements.length; i++) {
const mod = versionRequirements[i] const mod = versionRequirements[i];
if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) {
warnings.push(mod.name + ': ' + warnings.push(mod.name + ': ' +
chalk.red(mod.currentVersion) + ' should be ' + chalk.red(mod.currentVersion) + ' should be ' +
chalk.green(mod.versionRequirement) chalk.green(mod.versionRequirement),
) );
} }
} }
if (warnings.length) { if (warnings.length) {
console.log('') console.log('');
console.log(chalk.yellow('To use this template, you must update following to modules:')) console.log(chalk.yellow('To use this template, you must update following to modules:'));
console.log() console.log();
for (let i = 0; i < warnings.length; i++) { for (let i = 0; i < warnings.length; i++) {
const warning = warnings[i] const warning = warnings[i];
console.log(' ' + warning) console.log(' ' + warning);
} }
console.log() console.log();
process.exit(1) process.exit(1);
} }
} };
'use strict' 'use strict';
const path = require('path') const path = require('path');
const config = require('../config') const packageConfig = require('../package.json');
const ExtractTextPlugin = require('extract-text-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const packageConfig = require('../package.json') const fs = require('fs');
exports.assetsPath = function (_path) { const cssLoaders = function () {
const assetsSubDirectory = process.env.NODE_ENV === 'production' const sourceMap = process.env.NODE_ENV === 'production';
? config.build.assetsSubDirectory
: config.dev.assetsSubDirectory
return path.posix.join(assetsSubDirectory, _path)
}
exports.cssLoaders = function (options) {
options = options || {}
const cssLoader = { const cssLoader = {
loader: 'css-loader', loader: 'css-loader',
options: { options: {
sourceMap: options.sourceMap sourceMap,
} },
} };
const postcssLoader = { const postcssLoader = {
loader: 'postcss-loader', loader: 'postcss-loader',
options: { options: {
sourceMap: options.sourceMap sourceMap,
} },
} };
// generate loader string to be used with extract text plugin
function generateLoaders (loader, loaderOptions) { function generateLoaders (loader, loaderOptions) {
const loaders = options.usePostCSS ? [cssLoader, postcssLoader] : [cssLoader] const loaders = [cssLoader, postcssLoader];
if (loader) { if (loader) {
loaders.push({ loaders.push({
loader: loader + '-loader', loader: loader + '-loader',
options: Object.assign({}, loaderOptions, { options: Object.assign({}, loaderOptions, {
sourceMap: options.sourceMap sourceMap,
}) }),
}) });
}
// Extract CSS when that option is specified
// (which is the case during production build)
if (options.extract) {
return ExtractTextPlugin.extract({
use: loaders,
fallback: 'vue-style-loader'
})
} else {
return ['vue-style-loader'].concat(loaders)
} }
return [process.env.NODE_ENV === 'production' ? MiniCssExtractPlugin.loader : 'style-loader'].concat(loaders);
} }
// https://vue-loader.vuejs.org/en/configurations/extract-css.html
return { return {
css: generateLoaders(), css: generateLoaders(),
postcss: generateLoaders(), postcss: generateLoaders(),
less: generateLoaders('less'), less: generateLoaders('less'),
sass: generateLoaders('sass', { indentedSyntax: true }), sass: generateLoaders('sass', { sassOptions: { indentedSyntax: true } }),
scss: generateLoaders('sass'), scss: generateLoaders('sass'),
stylus: generateLoaders('stylus'), stylus: generateLoaders('stylus'),
styl: generateLoaders('stylus') styl: generateLoaders('stylus'),
} };
} };
// Generate loaders for standalone style files (outside of .vue) exports.styleLoaders = function () {
exports.styleLoaders = function (options) { const output = [];
const output = [] const loaders = cssLoaders();
const loaders = exports.cssLoaders(options)
for (const extension in loaders) { for (const extension in loaders) {
const loader = loaders[extension] const loader = loaders[extension];
output.push({ output.push({
test: new RegExp('\\.' + extension + '$'), test: new RegExp('\\.' + extension + '$'),
use: loader use: loader,
}) });
} }
return output return output;
} };
exports.createNotifierCallback = () => { exports.createNotifierCallback = () => {
const notifier = require('node-notifier') const notifier = require('node-notifier');
return (severity, errors) => { return (severity, errors) => {
if (severity !== 'error') return if (severity !== 'error') return;
const error = errors[0] const error = errors[0];
const filename = error.file && error.file.split('!').pop() const filename = error.file && error.file.split('!').pop();
notifier.notify({ notifier.notify({
title: packageConfig.name, title: packageConfig.name,
message: severity + ': ' + error.name, message: severity + ': ' + error.name,
subtitle: filename || '', subtitle: filename || '',
icon: path.join(__dirname, 'logo.png') icon: path.join(__dirname, 'logo.png'),
}) });
} };
} };
exports.envs = function () {
const env = path.join(__dirname, '../.env');
const envFiles = [
`${env}.${process.env.NODE_ENV}`,
`${env}`,
];
envFiles.forEach((path) => {
if (fs.existsSync(path)) {
require('dotenv-expand')(
require('dotenv').config({
path,
}),
);
}
});
const reg = /^DAMO_APP_/;
const stringified = Object.keys(process.env)
.filter((key) => reg.test(key))
.reduce((env, key) => {
env[`process.env.${key}`] = JSON.stringify(process.env[key]);
return env;
}, {});
console.log(stringified);
return stringified;
};
exports.hasFile = function (dir) {
let result = false;
if (!fs.existsSync(dir)) return false;
const paths = fs.readdirSync(path.resolve(dir));
if (paths.length === 0) return false;
paths.forEach(el => {
const _src = path.join(dir, el);
const stats = fs.statSync(_src);
if (stats.isFile()) {
result = true;
} else if (stats.isDirectory()) {
result = exports.hasFile(_src);
}
});
return result;
};
'use strict' 'use strict';
const path = require('path') const path = require('path');
const utils = require('./utils') const utils = require('./utils');
const config = require('../config') const { VueLoaderPlugin } = require('vue-loader');
const vueLoaderConfig = require('./vue-loader.conf') const ESLintPlugin = require('eslint-webpack-plugin');
const config = require('../config');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
function resolve (dir) { function resolve (dir) {
return path.join(__dirname, '..', dir) return path.join(__dirname, '..', dir);
} }
const createLintingRule = () => ({ const { outputDir = 'dist', publicPath = '/' } = config;
test: /\.(js|vue)$/,
loader: "eslint-loader",
enforce: "pre",
include: [resolve("src"), resolve("test")],
options: {
fix: true,
formatter: require("eslint-friendly-formatter"),
emitWarning: !config.dev.showEslintErrorsInOverlay
}
});
module.exports = { module.exports = {
context: path.resolve(__dirname, '../'), context: path.resolve(__dirname, '../'),
entry: { entry: ['./src/main.js'],
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: { resolve: {
extensions: ['.js', '.vue', '.json'], extensions: ['.js', '.vue', '.json'],
alias: { alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src'), '@': resolve('src'),
} },
},
output: {
path: path.resolve(__dirname, '..', outputDir),
filename: 'js/[name].[chunkhash].js',
chunkFilename: 'js/[name].[chunkhash].js',
publicPath: publicPath,
clean: true,
}, },
module: { module: {
rules: [ rules: [
...(config.dev.useEslint ? [createLintingRule()] : []),
{ {
test: /\.vue$/, test: /\.vue$/,
loader: 'vue-loader', loader: 'vue-loader',
options: vueLoaderConfig
}, },
{ {
test: /\.js$/, test: /\.js$/,
loader: 'babel-loader', loader: 'babel-loader',
include: [resolve('src'),resolve('static'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] include: [resolve('src')],
}, },
{ {
test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
loader: 'url-loader', type: 'asset',
options: { generator: {
limit: 10000, filename: 'img/[name].[hash:7].[ext]',
name: utils.assetsPath('img/[name].[hash:7].[ext]') },
} parser: {
dataUrlCondition: {
maxSize: 10000,
},
},
}, },
{ {
test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
loader: 'url-loader', type: 'asset',
options: { generator: {
limit: 10000, filename: 'media/[name].[hash:7].[ext]',
name: utils.assetsPath('media/[name].[hash:7].[ext]') },
} parser: {
dataUrlCondition: {
maxSize: 10000,
},
},
}, },
{ {
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
loader: 'url-loader', type: 'asset',
options: { generator: {
limit: 10000, filename: 'fonts/[name].[hash:7].[ext]',
name: utils.assetsPath('fonts/[name].[hash:7].[ext]') },
} parser: {
} dataUrlCondition: {
] maxSize: 10000,
},
},
},
...utils.styleLoaders(),
],
}, },
externals: { externals: {
'vue': 'Vue', vue: 'Vue',
'vue-router': 'VueRouter', 'vue-router': 'VueRouter',
'vuex': 'Vuex', vuex: 'Vuex',
'axios': 'axios', axios: 'axios',
'element-ui': 'ELEMENT' 'element-ui': 'ELEMENT',
}, },
node: { plugins: [
// prevent webpack from injecting useless setImmediate polyfill because Vue new VueLoaderPlugin(),
// source contains it (although only uses it if it's native). new ESLintPlugin({
setImmediate: false, extensions: ['js', 'vue'],
// prevent webpack from injecting mocks to Node native modules files: 'src',
// that does not make sense for the client fix: true,
dgram: 'empty', lintDirtyModulesOnly: true,
fs: 'empty', exclude: ['assets'],
net: 'empty', formatter: 'visualstudio',
tls: 'empty', }),
child_process: 'empty' new HtmlWebpackPlugin({
} template: 'index.html',
} }),
new webpack.DefinePlugin({
...utils.envs(),
}),
],
stats: 'errors-only',
};
'use strict' 'use strict';
const utils = require('./utils') process.env.NODE_ENV = 'development';
const webpack = require('webpack') const utils = require('./utils');
const config = require('../config') const config = require('../config');
const merge = require('webpack-merge') const { merge } = require('webpack-merge');
const path = require('path') const path = require('path');
const baseWebpackConfig = require('./webpack.base.conf') const baseWebpackConfig = require('./webpack.base.conf');
const CopyWebpackPlugin = require('copy-webpack-plugin') const FriendlyErrorsPlugin = require('@soda/friendly-errors-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin') const portfinder = require('portfinder');
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
const portfinder = require('portfinder')
const HOST = process.env.HOST const { port = '8080', publicPath = '/', devServerProxy } = config;
const PORT = process.env.PORT && Number(process.env.PORT)
const devWebpackConfig = merge(baseWebpackConfig, { const devWebpackConfig = merge(baseWebpackConfig, {
module: { mode: 'development',
rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) devtool: 'eval-source-map',
},
// cheap-module-eval-source-map is faster for development
devtool: config.dev.devtool,
// these devServer options should be customized in /config/index.js
devServer: { devServer: {
clientLogLevel: 'warning', client: {
historyApiFallback: { logging: 'warn',
rewrites: [ overlay: true,
{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }, progress: true,
],
}, },
hot: true, devMiddleware: {
contentBase: false, // since we use CopyWebpackPlugin. publicPath: publicPath,
compress: true, },
host: HOST || config.dev.host, onBeforeSetupMiddleware: function (devServer) {
port: PORT || config.dev.port, if (!devServer) {
open: config.dev.autoOpenBrowser, throw new Error('webpack-dev-server is not defined');
overlay: config.dev.errorOverlay }
? { warnings: false, errors: true } devServer.app.get('/', function (req, res) {
: false, res.redirect(publicPath);
publicPath: config.dev.assetsPublicPath, });
proxy: config.dev.proxyTable,
quiet: true, // necessary for FriendlyErrorsPlugin
watchOptions: {
poll: config.dev.poll,
}, },
before(app, server) { static: {
app.get(/^(?!\/integral-mall).*$/, (req, res) => { directory: path.join(__dirname, '../static'),
res.redirect('/integral-mall/'); publicPath: path.posix.join(publicPath, 'static'),
}) },
historyApiFallback: {
rewrites: [{ from: /.*/, to: path.posix.join(publicPath, 'index.html') }],
},
host: 'localhost',
port: port,
open: false,
proxy: devServerProxy,
watchFiles: {
options: {
usePolling: false,
},
}, },
}, },
plugins: [ });
new webpack.DefinePlugin({
'process.env': require('../config/dev.env')
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(), // HMR shows correct file names in console on update.
new webpack.NoEmitOnErrorsPlugin(),
// https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'index.html',
inject: true
}),
// copy custom static assets
new CopyWebpackPlugin([
{
from: path.resolve(__dirname, '../static'),
to: config.dev.assetsSubDirectory,
ignore: ['.*']
}
])
]
})
module.exports = new Promise((resolve, reject) => { module.exports = new Promise((resolve, reject) => {
portfinder.basePort = process.env.PORT || config.dev.port portfinder.basePort = port;
portfinder.getPort((err, port) => { portfinder.getPort((err, port) => {
if (err) { if (err) {
reject(err) reject(err);
} else { } else {
// publish the new Port, necessary for e2e tests devWebpackConfig.devServer.port = port;
process.env.PORT = port
// add port to devServer config
devWebpackConfig.devServer.port = port
// Add FriendlyErrorsPlugin devWebpackConfig.plugins.push(
devWebpackConfig.plugins.push(new FriendlyErrorsPlugin({ new FriendlyErrorsPlugin({
compilationSuccessInfo: { compilationSuccessInfo: {
messages: [`Your application is running here: http://${devWebpackConfig.devServer.host}:${port}`], messages: [`Your application is running here: http://localhost:${port}`],
}, },
onErrors: config.dev.notifyOnErrors onErrors: utils.createNotifierCallback(),
? utils.createNotifierCallback() }),
: undefined );
}))
resolve(devWebpackConfig) resolve(devWebpackConfig);
} }
}) });
}) });
'use strict' 'use strict';
const path = require('path') const path = require('path');
const utils = require('./utils') const utils = require('./utils');
const webpack = require('webpack') const webpack = require('webpack');
const config = require('../config') const config = require('../config');
const merge = require('webpack-merge') const { merge } = require('webpack-merge');
const baseWebpackConfig = require('./webpack.base.conf') const baseWebpackConfig = require('./webpack.base.conf');
const CopyWebpackPlugin = require('copy-webpack-plugin') const CopyWebpackPlugin = require('copy-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin') const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin') const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin')
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
const env = require('../config/prod.env') const { outputDir = 'dist', productionGzip = false } = config;
const webpackConfig = merge(baseWebpackConfig, { const webpackConfig = merge(baseWebpackConfig, {
module: { mode: 'production',
rules: utils.styleLoaders({ devtool: false,
sourceMap: config.build.productionSourceMap, optimization: {
extract: true, minimizer: [
usePostCSS: true '...',
}) new CssMinimizerPlugin(),
}, ],
devtool: config.build.productionSourceMap ? config.build.devtool : false,
output: {
path: config.build.assetsRoot,
publicPath:'./',
filename: utils.assetsPath('js/[name].[chunkhash].js'),
chunkFilename: utils.assetsPath('js/[id].[chunkhash].js')
}, },
plugins: [ plugins: [
// http://vuejs.github.io/vue-loader/en/workflow/production.html new MiniCssExtractPlugin({
new webpack.DefinePlugin({ filename: 'css/[name].[contenthash].css',
'process.env': env
}),
new UglifyJsPlugin({
uglifyOptions: {
compress: {
warnings: false
}
},
sourceMap: config.build.productionSourceMap,
parallel: true
}),
// extract css into its own file
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css'),
// Setting the following option to `false` will not extract CSS from codesplit chunks.
// Their CSS will instead be inserted dynamically with style-loader when the codesplit chunk has been loaded by webpack.
// It's currently set to `true` because we are seeing that sourcemaps are included in the codesplit bundle as well when it's `false`,
// increasing file size: https://github.com/vuejs-templates/webpack/issues/1110
allChunks: true,
}),
// Compress extracted CSS. We are using this plugin so that possible
// duplicated CSS from different components can be deduped.
new OptimizeCSSPlugin({
cssProcessorOptions: config.build.productionSourceMap
? { safe: true, map: { inline: false } }
: { safe: true }
}),
// generate dist index.html with correct asset hash for caching.
// you can customize output by editing /index.html
// see https://github.com/ampedandwired/html-webpack-plugin
new HtmlWebpackPlugin({
filename: config.build.index,
template: 'index.html',
inject: true,
minify: {
removeComments: true,
collapseWhitespace: true,
removeAttributeQuotes: true
// more options:
// https://github.com/kangax/html-minifier#options-quick-reference
},
// necessary to consistently work with multiple chunks via CommonsChunkPlugin
chunksSortMode: 'dependency'
}),
// keep module.id stable when vendor modules does not change
new webpack.HashedModuleIdsPlugin(),
// enable scope hoisting
new webpack.optimize.ModuleConcatenationPlugin(),
// split vendor js into its own file
new webpack.optimize.CommonsChunkPlugin({
name: 'vendor',
minChunks (module) {
// any required modules inside node_modules are extracted to vendor
return (
module.resource &&
/\.js$/.test(module.resource) &&
module.resource.indexOf(
path.join(__dirname, '../node_modules')
) === 0
)
}
}),
// extract webpack runtime and module manifest to its own file in order to
// prevent vendor hash from being updated whenever app bundle is updated
new webpack.optimize.CommonsChunkPlugin({
name: 'manifest',
minChunks: Infinity
}),
// This instance extracts shared chunks from code splitted chunks and bundles them
// in a separate chunk, similar to the vendor chunk
// see: https://webpack.js.org/plugins/commons-chunk-plugin/#extra-async-commons-chunk
new webpack.optimize.CommonsChunkPlugin({
name: 'app',
async: 'vendor-async',
children: true,
minChunks: 3
}), }),
new webpack.ids.HashedModuleIdsPlugin(),
],
});
// copy custom static assets const staticPath = path.resolve(__dirname, '../static');
new CopyWebpackPlugin([ if (utils.hasFile(staticPath)) {
{ webpackConfig.plugins.push(
from: path.resolve(__dirname, '../static'), new CopyWebpackPlugin({
to: config.build.assetsSubDirectory, patterns: [
ignore: ['.*'] {
} from: staticPath,
]) to: path.resolve(__dirname, '..', outputDir, 'static'),
] info: { minimized: true },
}) globOptions: {
ignore: ['.*'],
},
},
],
}),
);
}
if (config.build.productionGzip) { if (productionGzip) {
const CompressionWebpackPlugin = require('compression-webpack-plugin') const CompressionWebpackPlugin = require('compression-webpack-plugin');
webpackConfig.plugins.push( webpackConfig.plugins.push(
new CompressionWebpackPlugin({ new CompressionWebpackPlugin({
asset: '[path].gz[query]', filename: '[path].gz[query]',
algorithm: 'gzip', algorithm: 'gzip',
test: new RegExp( test: new RegExp('\\.(' + ['js', 'css'].join('|') + ')$'),
'\\.(' +
config.build.productionGzipExtensions.join('|') +
')$'
),
threshold: 10240, threshold: 10240,
minRatio: 0.8 minRatio: 0.8,
}) }),
) );
} }
if (config.build.bundleAnalyzerReport) { if (process.env.npm_config_report) {
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
webpackConfig.plugins.push(new BundleAnalyzerPlugin()) webpackConfig.plugins.push(new BundleAnalyzerPlugin());
} }
module.exports = webpackConfig module.exports = webpackConfig;
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [2, 'always', ['update', 'feat', 'fix', 'refactor', 'docs', 'chore', 'style', 'revert', 'build']],
},
};
'use strict' 'use strict';
// Template version: 1.3.1
// see http://vuejs-templates.github.io/webpack for documentation.
const path = require('path')
module.exports = { module.exports = {
dev: { publicPath: '/integral-mall/',
devServerProxy: {
// Paths '/api-.*/': {
assetsSubDirectory: 'static', target: 'http://gicdev.demogic.com',
assetsPublicPath: '/integral-mall', changeOrigin: true,
// proxyTable: {},
proxyTable: {
'/api/': {
target: 'http://gicdev.demogic.com',
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
},
'/api-auth/': {
target: 'http://gicdev.demogic.com/api-auth/',
changeOrigin: true,
pathRewrite: {
'^/api-auth': ''
}
}
}, },
// Various Dev Server settings
host: 'localhost', // can be overwritten by process.env.HOST
port: 8002, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false,
errorOverlay: true,
notifyOnErrors: true,
poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
// Use Eslint Loader?
// If true, your code will be linted during bundling and
// linting errors and warnings will be shown in the console.
useEslint: true,
// If true, eslint errors and warnings will also be shown in the error overlay
// in the browser.
showEslintErrorsInOverlay: false,
/**
* Source Maps
*/
// https://webpack.js.org/configuration/devtool/#development
devtool: 'cheap-module-eval-source-map',
// If you have problems debugging vue-files in devtools,
// set this to false - it *may* help
// https://vue-loader.vuejs.org/en/options.html#cachebusting
cacheBusting: true,
cssSourceMap: true
}, },
};
build: {
// Template for index.html
index: path.resolve(__dirname, '../dist/index.html'),
// Paths
assetsRoot: path.resolve(__dirname, '../dist'),
assetsSubDirectory: 'static',
assetsPublicPath: './',
/**
* Source Maps
*/
productionSourceMap: false,
// https://webpack.js.org/configuration/devtool/#production
devtool: '#source-map',
// Gzip off by default as many popular static hosts such as
// Surge or Netlify already gzip all static assets for you.
// Before setting to `true`, make sure to:
// npm install --save-dev compression-webpack-plugin
productionGzip: false,
productionGzipExtensions: ['js', 'css'],
// Run the build command with an extra argument to
// View the bundle analyzer report after build finishes:
// `npm run build --report`
// Set to `true` or `false` to always turn it on or off
bundleAnalyzerReport: process.env.npm_config_report
}
}
module.exports = {
'src/**/*.{js,vue}': 'eslint --ext .js --ext .vue --ext src/',
};
This source diff could not be displayed because it is too large. You can view the blob instead.
{ {
"name": "y", "name": "gic",
"version": "1.0.0", "description": "damo project",
"description": "A Vue.js project", "author": "damo",
"author": "dmg", "private": true,
"private": true, "scripts": {
"scripts": { "dev": "webpack server --progress --config build/webpack.dev.conf.js",
"dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", "build": "node build/build.js",
"start": "npm run dev", "lint": "eslint --ext .js --ext .vue src/ --fix",
"build": "node build/build.js", "prepare": "husky install"
"format": "onchange 'test/**/*.js' 'src/**/*.js' 'src/**/*.vue' -- prettier --write {{changed}}", },
"formater": "onchange \"test/**/*.js\" \"src/**/*.js\" \"src/**/*.vue\" -- prettier --write {{changed}}" "devDependencies": {
}, "@babel/core": "7.16.0",
"dependencies": { "@babel/eslint-parser": "7.16.3",
"@riophae/vue-treeselect": "0.0.35", "@babel/preset-env": "7.16.0",
"@tinymce/tinymce-vue": "^1.0.8", "@commitlint/cli": "^14.1.0",
"axios": "^0.18.0", "@commitlint/config-conventional": "^14.1.0",
"babel-polyfill": "^6.26.0", "@soda/friendly-errors-webpack-plugin": "^1.8.0",
"element-ui": "^2.4.0", "@vue/babel-helper-vue-jsx-merge-props": "^1.2.1",
"es6-promise": "^4.2.6", "@vue/babel-preset-jsx": "^1.2.4",
"less": "^3.0.4", "autoprefixer": "10.4.0",
"less-loader": "^4.1.0", "babel-loader": "8.2.3",
"tinymce": "^4.8.2", "chalk": "4.1.2",
"vue": "2.6.6", "copy-webpack-plugin": "9.0.1",
"vue-axios": "^2.1.1", "css-loader": "6.5.1",
"vue-clipboard2": "^0.2.1", "css-minimizer-webpack-plugin": "3.1.3",
"vuedraggable": "^2.24.3", "dotenv": "10.0.0",
"vuex": "^3.0.1" "dotenv-expand": "5.1.0",
}, "eslint": "8.2.0",
"devDependencies": { "eslint-config-standard": "^16.0.3",
"autoprefixer": "^7.1.2", "eslint-plugin-import": "^2.25.3",
"babel-core": "^6.22.1", "eslint-plugin-node": "^11.1.0",
"babel-eslint": "^8.2.1", "eslint-plugin-promise": "^5.1.1",
"babel-helper-vue-jsx-merge-props": "^2.0.3", "eslint-plugin-vue": "^8.0.3",
"babel-loader": "^7.1.1", "eslint-webpack-plugin": "^3.1.1",
"babel-plugin-syntax-jsx": "^6.18.0", "html-webpack-plugin": "5.5.0",
"babel-plugin-transform-runtime": "^6.22.0", "husky": "^7.0.0",
"babel-plugin-transform-vue-jsx": "^3.5.0", "lint-staged": "^12.0.2",
"babel-preset-env": "^1.3.2", "mini-css-extract-plugin": "2.4.4",
"babel-preset-stage-2": "^6.22.0", "node-notifier": "10.0.0",
"chalk": "^2.0.1", "node-sass": "4.14.1",
"copy-webpack-plugin": "^4.0.1", "ora": "^5.4.1",
"css-loader": "^0.28.0", "portfinder": "^1.0.27",
"eslint": "^4.15.0", "postcss": "8.3.11",
"eslint-config-prettier": "^3.6.0", "postcss-import": "^14.0.2",
"eslint-config-standard": "^10.2.1", "postcss-loader": "6.2.0",
"eslint-friendly-formatter": "^3.0.0", "postcss-url": "^10.1.3",
"eslint-loader": "^1.7.1", "sass-loader": "^7.0.3",
"eslint-plugin-import": "^2.7.0", "semver": "7.3.5",
"eslint-plugin-node": "^5.2.0", "shelljs": "0.8.4",
"eslint-plugin-prettier": "^3.0.1", "style-loader": "3.3.1",
"eslint-plugin-promise": "^3.4.0", "vue-eslint-parser": "^8.0.1",
"eslint-plugin-standard": "^3.0.1", "vue-loader": "15.9.8",
"eslint-plugin-vue": "^4.0.0", "vue-template-compiler": "2.6.6",
"extract-text-webpack-plugin": "^3.0.0", "webpack": "5.56.0",
"file-loader": "^1.1.4", "webpack-bundle-analyzer": "4.5.0",
"friendly-errors-webpack-plugin": "^1.6.1", "webpack-cli": "4.9.1",
"html-webpack-plugin": "^2.30.1", "webpack-dev-server": "4.3.0",
"node-notifier": "^5.1.2", "webpack-merge": "5.8.0"
"node-sass": "^4.12.0", },
"onchange": "^5.2.0", "optionalDependencies": {
"optimize-css-assets-webpack-plugin": "^3.2.0", "fsevents": "*"
"ora": "^1.2.0", },
"portfinder": "^1.0.13", "engines": {
"postcss-import": "^11.0.0", "node": ">= 12.22.0",
"postcss-loader": "^2.0.8", "npm": ">= 6.14.11"
"postcss-url": "^7.2.1", },
"prettier": "^1.16.4", "browserslist": [
"rimraf": "^2.6.0", "> 1%",
"sass-loader": "^8.0.0", "last 2 versions",
"semver": "^5.3.0", "not ie <= 8"
"shelljs": "^0.7.6", ],
"uglifyjs-webpack-plugin": "^1.1.1", "dependencies": {
"url-loader": "^0.5.8", "@riophae/vue-treeselect": "0.0.35",
"vue-loader": "^13.3.0", "@tinymce/tinymce-vue": "^1.0.8",
"vue-style-loader": "^3.0.1", "axios": "^0.18.0",
"vue-template-compiler": "2.6.6", "babel-polyfill": "^6.26.0",
"webpack": "^3.6.0", "element-ui": "^2.4.0",
"webpack-bundle-analyzer": "^2.9.0", "es6-promise": "^4.2.6",
"webpack-dev-server": "^2.9.7", "less": "^3.0.4",
"webpack-merge": "^4.1.0" "less-loader": "^4.1.0",
}, "tinymce": "^4.8.2",
"engines": { "vue": "2.6.6",
"node": ">= 6.0.0", "vue-axios": "^2.1.1",
"npm": ">= 3.0.0" "vue-clipboard2": "^0.2.1",
}, "vuedraggable": "^2.24.3",
"browserslist": [ "vuex": "^3.0.1"
"> 1%", }
"last 2 versions",
"not ie <= 8"
]
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment