Tweak webpack config
This commit is contained in:
parent
5d80b8e06a
commit
83c1806d2b
|
|
@ -11,7 +11,7 @@
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "webpack-dev-server",
|
"dev": "webpack-dev-server",
|
||||||
"build": "rimraf public/app && webpack --mode=production",
|
"build": "rimraf public/app && webpack --mode=production -p",
|
||||||
"lint": "eslint --ext=.js,.vue,.ts -f=beauty .",
|
"lint": "eslint --ext=.js,.vue,.ts -f=beauty .",
|
||||||
"test": "tsc -p . && jest",
|
"test": "tsc -p . && jest",
|
||||||
"codecov": "codecov -F js"
|
"codecov": "codecov -F js"
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
"@types/jest": "^24.0.11",
|
"@types/jest": "^24.0.11",
|
||||||
"@types/jquery": "^3.3.9",
|
"@types/jquery": "^3.3.9",
|
||||||
"@types/toastr": "^2.1.36",
|
"@types/toastr": "^2.1.36",
|
||||||
|
"@types/webpack": "^4.4.25",
|
||||||
"@typescript-eslint/eslint-plugin": "^1.4.2",
|
"@typescript-eslint/eslint-plugin": "^1.4.2",
|
||||||
"@typescript-eslint/parser": "^1.4.2",
|
"@typescript-eslint/parser": "^1.4.2",
|
||||||
"@vue/test-utils": "^1.0.0-beta.29",
|
"@vue/test-utils": "^1.0.0-beta.29",
|
||||||
|
|
@ -60,6 +61,7 @@
|
||||||
"eslint-formatter-beauty": "^3.0.0",
|
"eslint-formatter-beauty": "^3.0.0",
|
||||||
"eslint-plugin-project": "^0.2.2",
|
"eslint-plugin-project": "^0.2.2",
|
||||||
"eslint-plugin-vue": "^5.2.2",
|
"eslint-plugin-vue": "^5.2.2",
|
||||||
|
"expose-loader": "^0.7.5",
|
||||||
"file-loader": "^3.0.1",
|
"file-loader": "^3.0.1",
|
||||||
"jest": "^24.5.0",
|
"jest": "^24.5.0",
|
||||||
"jest-extended": "^0.11.1",
|
"jest-extended": "^0.11.1",
|
||||||
|
|
|
||||||
4
resources/assets/src/js/jquery.js
vendored
4
resources/assets/src/js/jquery.js
vendored
|
|
@ -1,4 +0,0 @@
|
||||||
import $ from 'jquery'
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-multi-assign
|
|
||||||
window.$ = window.jQuery = $
|
|
||||||
|
|
@ -1,4 +1,3 @@
|
||||||
import './jquery' // jQuery first
|
|
||||||
import 'bootstrap' // eslint-disable-line import/no-extraneous-dependencies
|
import 'bootstrap' // eslint-disable-line import/no-extraneous-dependencies
|
||||||
import 'admin-lte'
|
import 'admin-lte'
|
||||||
import 'icheck'
|
import 'icheck'
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||||
const WebpackBar = require('webpackbar')
|
const WebpackBar = require('webpackbar')
|
||||||
|
|
||||||
const devMode = !process.argv.includes('--mode=production')
|
const devMode = !process.argv.includes('-p')
|
||||||
|
|
||||||
/** @type {import('webpack').Configuration} */
|
/** @type {import('webpack').Configuration} */
|
||||||
const config = {
|
const config = {
|
||||||
|
|
@ -73,7 +73,7 @@ const config = {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.yml$/,
|
test: /\.ya?ml$/,
|
||||||
use: ['json-loader', 'yaml-loader'],
|
use: ['json-loader', 'yaml-loader'],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -87,6 +87,19 @@ const config = {
|
||||||
test: /\.(svg|woff2?|eot|ttf)$/,
|
test: /\.(svg|woff2?|eot|ttf)$/,
|
||||||
loader: 'file-loader',
|
loader: 'file-loader',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: require.resolve('jquery'),
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: 'expose-loader',
|
||||||
|
options: 'jQuery',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'expose-loader',
|
||||||
|
options: '$',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
],
|
],
|
||||||
noParse: /^(vue|jquery)$/,
|
noParse: /^(vue|jquery)$/,
|
||||||
},
|
},
|
||||||
|
|
@ -131,13 +144,7 @@ const config = {
|
||||||
if (devMode) {
|
if (devMode) {
|
||||||
config.plugins.push(new webpack.HotModuleReplacementPlugin())
|
config.plugins.push(new webpack.HotModuleReplacementPlugin())
|
||||||
} else {
|
} else {
|
||||||
process.env.NODE_ENV = 'production'
|
|
||||||
config.plugins.push(new WebpackBar())
|
config.plugins.push(new WebpackBar())
|
||||||
config.plugins.push(
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|
|
||||||
33
yarn.lock
33
yarn.lock
|
|
@ -901,6 +901,11 @@
|
||||||
"@types/istanbul-lib-coverage" "^1.1.0"
|
"@types/istanbul-lib-coverage" "^1.1.0"
|
||||||
"@types/yargs" "^12.0.9"
|
"@types/yargs" "^12.0.9"
|
||||||
|
|
||||||
|
"@types/anymatch@*":
|
||||||
|
version "1.3.1"
|
||||||
|
resolved "https://registry.npmjs.org/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
|
||||||
|
integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==
|
||||||
|
|
||||||
"@types/babel__core@^7.1.0":
|
"@types/babel__core@^7.1.0":
|
||||||
version "7.1.0"
|
version "7.1.0"
|
||||||
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51"
|
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.0.tgz#710f2487dda4dcfd010ca6abb2b4dc7394365c51"
|
||||||
|
|
@ -977,6 +982,11 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
|
resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e"
|
||||||
integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==
|
integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw==
|
||||||
|
|
||||||
|
"@types/tapable@*":
|
||||||
|
version "1.0.4"
|
||||||
|
resolved "https://registry.npmjs.org/@types/tapable/-/tapable-1.0.4.tgz#b4ffc7dc97b498c969b360a41eee247f82616370"
|
||||||
|
integrity sha512-78AdXtlhpCHT0K3EytMpn4JNxaf5tbqbLcbIRoQIHzpTIyjpxLQKRoxU55ujBXAtg3Nl2h/XWvfDa9dsMOd0pQ==
|
||||||
|
|
||||||
"@types/toastr@^2.1.36":
|
"@types/toastr@^2.1.36":
|
||||||
version "2.1.36"
|
version "2.1.36"
|
||||||
resolved "https://registry.npmjs.org/@types/toastr/-/toastr-2.1.36.tgz#6b692ec384147324cffe13892e9e5b26bd1e69e7"
|
resolved "https://registry.npmjs.org/@types/toastr/-/toastr-2.1.36.tgz#6b692ec384147324cffe13892e9e5b26bd1e69e7"
|
||||||
|
|
@ -984,6 +994,24 @@
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/jquery" "*"
|
"@types/jquery" "*"
|
||||||
|
|
||||||
|
"@types/uglify-js@*":
|
||||||
|
version "3.0.4"
|
||||||
|
resolved "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.0.4.tgz#96beae23df6f561862a830b4288a49e86baac082"
|
||||||
|
integrity sha512-SudIN9TRJ+v8g5pTG8RRCqfqTMNqgWCKKd3vtynhGzkIIjxaicNAMuY5TRadJ6tzDu3Dotf3ngaMILtmOdmWEQ==
|
||||||
|
dependencies:
|
||||||
|
source-map "^0.6.1"
|
||||||
|
|
||||||
|
"@types/webpack@^4.4.25":
|
||||||
|
version "4.4.25"
|
||||||
|
resolved "https://registry.npmjs.org/@types/webpack/-/webpack-4.4.25.tgz#c8a1eb968a33a3e6da641f529c5add0d44d34809"
|
||||||
|
integrity sha512-YaYVbSK1bC3xiAWFLSgDQyVHdCTNq5cLlcx633basmrwSoUxJiv4SZ0SoT1uoF15zWx98afOcCbqA1YHeCdRYA==
|
||||||
|
dependencies:
|
||||||
|
"@types/anymatch" "*"
|
||||||
|
"@types/node" "*"
|
||||||
|
"@types/tapable" "*"
|
||||||
|
"@types/uglify-js" "*"
|
||||||
|
source-map "^0.6.0"
|
||||||
|
|
||||||
"@types/yargs@^12.0.2", "@types/yargs@^12.0.9":
|
"@types/yargs@^12.0.2", "@types/yargs@^12.0.9":
|
||||||
version "12.0.9"
|
version "12.0.9"
|
||||||
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0"
|
resolved "https://registry.yarnpkg.com/@types/yargs/-/yargs-12.0.9.tgz#693e76a52f61a2f1e7fb48c0eef167b95ea4ffd0"
|
||||||
|
|
@ -3528,6 +3556,11 @@ expect@^24.5.0:
|
||||||
jest-message-util "^24.5.0"
|
jest-message-util "^24.5.0"
|
||||||
jest-regex-util "^24.3.0"
|
jest-regex-util "^24.3.0"
|
||||||
|
|
||||||
|
expose-loader@^0.7.5:
|
||||||
|
version "0.7.5"
|
||||||
|
resolved "https://registry.npmjs.org/expose-loader/-/expose-loader-0.7.5.tgz#e29ea2d9aeeed3254a3faa1b35f502db9f9c3f6f"
|
||||||
|
integrity sha512-iPowgKUZkTPX5PznYsmifVj9Bob0w2wTHVkt/eYNPSzyebkUgIedmskf/kcfEIWpiWjg3JRjnW+a17XypySMuw==
|
||||||
|
|
||||||
express@^4.16.2:
|
express@^4.16.2:
|
||||||
version "4.16.4"
|
version "4.16.4"
|
||||||
resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e"
|
resolved "https://registry.yarnpkg.com/express/-/express-4.16.4.tgz#fddef61926109e24c515ea97fd2f1bdbf62df12e"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user