Simplify webpack configuration
Signed-off-by: Raimund Schlüßler <raimund.schluessler@mailbox.org>
This commit is contained in:
Родитель
87789411d4
Коммит
a2d92fee54
|
@ -16,7 +16,7 @@ const getCompareSnapshotsPlugin = require('cypress-visual-regression/dist/plugin
|
||||||
const webpack = require('@cypress/webpack-preprocessor')
|
const webpack = require('@cypress/webpack-preprocessor')
|
||||||
const { startDevServer } = require('@cypress/webpack-dev-server')
|
const { startDevServer } = require('@cypress/webpack-dev-server')
|
||||||
|
|
||||||
const webpackOptions = require('../../webpack.dev.js')
|
const webpackOptions = require('../../webpack.config.js')
|
||||||
webpackOptions.externals = {}
|
webpackOptions.externals = {}
|
||||||
|
|
||||||
const options = {
|
const options = {
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
"author": "John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>",
|
"author": "John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>",
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack --config webpack.dev.js",
|
"dev": "webpack --node-env development --progress",
|
||||||
"watch": "webpack --progress --watch --config webpack.dev.js",
|
"watch": "webpack --node-env development --progress --watch",
|
||||||
"build": "NODE_ENV=production webpack --progress --config webpack.prod.js",
|
"build": "webpack --node-env production --progress",
|
||||||
"l10n:extract": "node build/extract-l10n.js",
|
"l10n:extract": "node build/extract-l10n.js",
|
||||||
"lint": "eslint --ext .js,.vue src",
|
"lint": "eslint --ext .js,.vue src",
|
||||||
"lint:fix": "eslint --ext .js,.vue src --fix",
|
"lint:fix": "eslint --ext .js,.vue src --fix",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const { merge } = require('webpack-merge')
|
const { merge } = require('webpack-merge')
|
||||||
const webpackConfig = require('./webpack.dev.js')
|
const webpackConfig = require('./webpack.config.js')
|
||||||
|
|
||||||
const newConfig = Object.assign({}, webpackConfig, {
|
const newConfig = Object.assign({}, webpackConfig, {
|
||||||
externals: {},
|
externals: {},
|
||||||
|
|
|
@ -4,6 +4,9 @@ const glob = require('glob')
|
||||||
const md5 = require('md5')
|
const md5 = require('md5')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
|
const buildMode = process.env.NODE_ENV
|
||||||
|
const isDev = buildMode === 'development'
|
||||||
|
|
||||||
const { DefinePlugin } = require('webpack')
|
const { DefinePlugin } = require('webpack')
|
||||||
const { VueLoaderPlugin } = require('vue-loader')
|
const { VueLoaderPlugin } = require('vue-loader')
|
||||||
const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
|
const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
|
||||||
|
@ -54,6 +57,13 @@ const translations = fs
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
mode: buildMode,
|
||||||
|
devtool: isDev ? false : 'source-map',
|
||||||
|
devServer: {
|
||||||
|
historyApiFallback: true,
|
||||||
|
noInfo: true,
|
||||||
|
overlay: true,
|
||||||
|
},
|
||||||
entry: {
|
entry: {
|
||||||
ncvuecomponents: path.join(__dirname, 'src', 'index.js'),
|
ncvuecomponents: path.join(__dirname, 'src', 'index.js'),
|
||||||
...glob.sync('src/components/*/index.js').reduce((acc, item) => {
|
...glob.sync('src/components/*/index.js').reduce((acc, item) => {
|
|
@ -1,11 +0,0 @@
|
||||||
const { merge } = require('webpack-merge')
|
|
||||||
const common = require('./webpack.common.js')
|
|
||||||
|
|
||||||
module.exports = merge(common, {
|
|
||||||
mode: 'development',
|
|
||||||
devServer: {
|
|
||||||
historyApiFallback: true,
|
|
||||||
noInfo: true,
|
|
||||||
overlay: true,
|
|
||||||
},
|
|
||||||
})
|
|
|
@ -1,7 +0,0 @@
|
||||||
const { merge } = require('webpack-merge')
|
|
||||||
const common = require('./webpack.common.js')
|
|
||||||
|
|
||||||
module.exports = merge(common, {
|
|
||||||
mode: 'production',
|
|
||||||
devtool: 'source-map'
|
|
||||||
})
|
|
Загрузка…
Ссылка в новой задаче