Only generate the web assets directory during web builds (#2528)
* Webpack 5 optimises productions builds by default, no need for the LoaderOptionsPlugin * Only create web assets during web build
This commit is contained in:
parent
44c010c5fe
commit
9961183c1b
|
@ -68,13 +68,9 @@ if (isDevMode) {
|
|||
config.plugins.push(
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.join(__dirname, '../static/pwabuilder-sw.js'),
|
||||
to: path.join(__dirname, '../dist/web/pwabuilder-sw.js'),
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '../static'),
|
||||
to: path.join(__dirname, '../dist/web/static'),
|
||||
to: path.join(__dirname, '../dist/static'),
|
||||
globOptions: {
|
||||
dot: true,
|
||||
ignore: ['**/.*', '**/pwabuilder-sw.js', '**/dashFiles/**', '**/storyboards/**'],
|
||||
|
@ -96,11 +92,7 @@ if (isDevMode) {
|
|||
ignore: ['**/.*'],
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
]
|
||||
})
|
||||
)
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ const path = require('path')
|
|||
const webpack = require('webpack')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
|
||||
const {
|
||||
|
@ -54,11 +53,8 @@ const config = {
|
|||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {},
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
},
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
|
@ -75,8 +71,7 @@ const config = {
|
|||
test: /\.css$/,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {},
|
||||
loader: MiniCssExtractPlugin.loader
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
|
@ -153,53 +148,6 @@ if (isDevMode) {
|
|||
__static: `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`,
|
||||
})
|
||||
)
|
||||
} else {
|
||||
config.plugins.push(
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{
|
||||
from: path.join(__dirname, '../static/pwabuilder-sw.js'),
|
||||
to: path.join(__dirname, '../dist/web/pwabuilder-sw.js'),
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '../static'),
|
||||
to: path.join(__dirname, '../dist/web/static'),
|
||||
globOptions: {
|
||||
dot: true,
|
||||
ignore: ['**/.*', '**/pwabuilder-sw.js', '**/dashFiles/**', '**/storyboards/**'],
|
||||
},
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '../static'),
|
||||
to: path.join(__dirname, '../dist/static'),
|
||||
globOptions: {
|
||||
dot: true,
|
||||
ignore: ['**/.*', '**/pwabuilder-sw.js', '**/dashFiles/**', '**/storyboards/**'],
|
||||
},
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '../_icons'),
|
||||
to: path.join(__dirname, '../dist/web/_icons'),
|
||||
globOptions: {
|
||||
dot: true,
|
||||
ignore: ['**/.*'],
|
||||
},
|
||||
},
|
||||
{
|
||||
from: path.join(__dirname, '../src/renderer/assets/img'),
|
||||
to: path.join(__dirname, '../dist/web/images'),
|
||||
globOptions: {
|
||||
dot: true,
|
||||
ignore: ['**/.*'],
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
|
|
|
@ -46,11 +46,8 @@ const config = {
|
|||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {},
|
||||
},
|
||||
{
|
||||
loader: 'css-loader',
|
||||
},
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
|
@ -67,8 +64,7 @@ const config = {
|
|||
test: /\.css$/,
|
||||
use: [
|
||||
{
|
||||
loader: MiniCssExtractPlugin.loader,
|
||||
options: {},
|
||||
loader: MiniCssExtractPlugin.loader
|
||||
},
|
||||
'css-loader',
|
||||
],
|
||||
|
@ -183,11 +179,7 @@ if (isDevMode) {
|
|||
ignore: ['**/.*'],
|
||||
},
|
||||
},
|
||||
]
|
||||
}
|
||||
),
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
]
|
||||
})
|
||||
)
|
||||
}
|
||||
|
|
|
@ -63,11 +63,7 @@ const config = {
|
|||
if (isDevMode) {
|
||||
// any dev only config
|
||||
} else {
|
||||
config.plugins.push(
|
||||
new webpack.LoaderOptionsPlugin({
|
||||
minimize: true,
|
||||
})
|
||||
)
|
||||
// any producation only config
|
||||
}
|
||||
|
||||
module.exports = config
|
||||
|
|
Loading…
Reference in New Issue