Restructure project folders and remove obsolete files
All checks were successful
Deploy Spot / deploy (push) Successful in 34s
All checks were successful
Deploy Spot / deploy (push) Successful in 34s
This commit is contained in:
@@ -1,14 +1,12 @@
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const webpack = require('webpack');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const SymlinkWebpackPlugin = require('symlink-webpack-plugin');
|
||||
const { VueLoaderPlugin } = require('vue-loader');
|
||||
|
||||
const ROOT = path.resolve(__dirname, '..');
|
||||
const SRC = path.resolve(ROOT, 'src');
|
||||
const DIST = path.resolve(ROOT, 'dist');
|
||||
const LIB = path.resolve(ROOT, 'lib');
|
||||
const PUBLIC = path.resolve(ROOT, 'public');
|
||||
|
||||
module.exports = (env, argv) => {
|
||||
const mode = argv.mode || 'production';
|
||||
@@ -22,12 +20,12 @@ module.exports = (env, argv) => {
|
||||
app: path.resolve(SRC, 'app.js')
|
||||
},
|
||||
output: {
|
||||
path: DIST,
|
||||
filename: isDev ? '[name].js' : '[name].[contenthash:8].js',
|
||||
chunkFilename: isDev ? '[name].js' : '[name].[contenthash:8].js',
|
||||
path: PUBLIC,
|
||||
filename: isDev ? 'assets/[name].js' : 'assets/[name].[contenthash:8].js',
|
||||
chunkFilename: isDev ? 'assets/[name].js' : 'assets/[name].[contenthash:8].js',
|
||||
publicPath: './',
|
||||
clean: {
|
||||
keep: /^(files|geo|images\/icons)(\/.*)?$/
|
||||
keep: /^(index\.php|files|geo|images\/icons)(\/.*)?$/
|
||||
}
|
||||
},
|
||||
optimization: {
|
||||
@@ -86,7 +84,7 @@ module.exports = (env, argv) => {
|
||||
test: /\.css$/i,
|
||||
use: ['vue-style-loader', 'css-loader']
|
||||
}, {
|
||||
test: /\.(png|svg|jpg|jpeg|gif)$/i,
|
||||
test: /\.(png|svg|jpg|jpeg|gif|webp)$/i,
|
||||
type: 'asset',
|
||||
parser: {
|
||||
dataUrlCondition: {
|
||||
@@ -94,20 +92,15 @@ module.exports = (env, argv) => {
|
||||
}
|
||||
},
|
||||
generator: {
|
||||
filename: 'images/[name].[contenthash:8][ext]'
|
||||
filename: 'assets/images/[name].[contenthash:8][ext]'
|
||||
}
|
||||
}]
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: path.resolve(LIB, 'index.php'), to: 'index.php' }
|
||||
]
|
||||
}),
|
||||
new SymlinkWebpackPlugin([
|
||||
{ origin: '../files/', symlink: 'files' },
|
||||
{ origin: '../geo/', symlink: 'geo' },
|
||||
{ origin: '../src/images/icons/', symlink: 'images/icons' }
|
||||
{ origin: '../resources/geo/', symlink: 'geo' },
|
||||
{ origin: '../src/images/icons/', symlink: 'assets/images/icons' }
|
||||
]),
|
||||
new webpack.DefinePlugin({
|
||||
__VUE_OPTIONS_API__: 'true',
|
||||
@@ -122,7 +115,8 @@ module.exports = (env, argv) => {
|
||||
chunkGroups: mapChunkGroups(stats.compilation.chunkGroups)
|
||||
};
|
||||
|
||||
fs.writeFileSync(path.resolve(DIST, 'entrypoints.json'), JSON.stringify(manifest, null, '\t'));
|
||||
fs.mkdirSync(path.resolve(PUBLIC, 'assets'), { recursive: true });
|
||||
fs.writeFileSync(path.resolve(PUBLIC, 'assets', 'entrypoints.json'), JSON.stringify(manifest, null, '\t'));
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user