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(
|
config.plugins.push(
|
||||||
new CopyWebpackPlugin({
|
new CopyWebpackPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{
|
|
||||||
from: path.join(__dirname, '../static/pwabuilder-sw.js'),
|
|
||||||
to: path.join(__dirname, '../dist/web/pwabuilder-sw.js'),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
from: path.join(__dirname, '../static'),
|
from: path.join(__dirname, '../static'),
|
||||||
to: path.join(__dirname, '../dist/web/static'),
|
to: path.join(__dirname, '../dist/static'),
|
||||||
globOptions: {
|
globOptions: {
|
||||||
dot: true,
|
dot: true,
|
||||||
ignore: ['**/.*', '**/pwabuilder-sw.js', '**/dashFiles/**', '**/storyboards/**'],
|
ignore: ['**/.*', '**/pwabuilder-sw.js', '**/dashFiles/**', '**/storyboards/**'],
|
||||||
|
@ -97,10 +93,6 @@ if (isDevMode) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
|
||||||
),
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
minimize: true,
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ const path = require('path')
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
const VueLoaderPlugin = require('vue-loader/lib/plugin')
|
||||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
|
||||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
@ -54,11 +53,8 @@ const config = {
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: MiniCssExtractPlugin.loader,
|
loader: MiniCssExtractPlugin.loader,
|
||||||
options: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
},
|
},
|
||||||
|
'css-loader',
|
||||||
{
|
{
|
||||||
loader: 'sass-loader',
|
loader: 'sass-loader',
|
||||||
options: {
|
options: {
|
||||||
|
@ -75,8 +71,7 @@ const config = {
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: MiniCssExtractPlugin.loader,
|
loader: MiniCssExtractPlugin.loader
|
||||||
options: {},
|
|
||||||
},
|
},
|
||||||
'css-loader',
|
'css-loader',
|
||||||
],
|
],
|
||||||
|
@ -153,53 +148,6 @@ if (isDevMode) {
|
||||||
__static: `"${path.join(__dirname, '../static').replace(/\\/g, '\\\\')}"`,
|
__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
|
module.exports = config
|
||||||
|
|
|
@ -46,11 +46,8 @@ const config = {
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: MiniCssExtractPlugin.loader,
|
loader: MiniCssExtractPlugin.loader,
|
||||||
options: {},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
},
|
},
|
||||||
|
'css-loader',
|
||||||
{
|
{
|
||||||
loader: 'sass-loader',
|
loader: 'sass-loader',
|
||||||
options: {
|
options: {
|
||||||
|
@ -67,8 +64,7 @@ const config = {
|
||||||
test: /\.css$/,
|
test: /\.css$/,
|
||||||
use: [
|
use: [
|
||||||
{
|
{
|
||||||
loader: MiniCssExtractPlugin.loader,
|
loader: MiniCssExtractPlugin.loader
|
||||||
options: {},
|
|
||||||
},
|
},
|
||||||
'css-loader',
|
'css-loader',
|
||||||
],
|
],
|
||||||
|
@ -184,10 +180,6 @@ if (isDevMode) {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
}
|
|
||||||
),
|
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
minimize: true,
|
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,11 +63,7 @@ const config = {
|
||||||
if (isDevMode) {
|
if (isDevMode) {
|
||||||
// any dev only config
|
// any dev only config
|
||||||
} else {
|
} else {
|
||||||
config.plugins.push(
|
// any producation only config
|
||||||
new webpack.LoaderOptionsPlugin({
|
|
||||||
minimize: true,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = config
|
module.exports = config
|
||||||
|
|
Loading…
Reference in New Issue