Separated image, js and css files
This commit is contained in:
parent
bedaae5a7c
commit
65dc29a229
2 changed files with 24 additions and 12 deletions
|
@ -19,6 +19,7 @@
|
||||||
"webpack/ManifestPlugin.ts",
|
"webpack/ManifestPlugin.ts",
|
||||||
|
|
||||||
"babel.config.ts",
|
"babel.config.ts",
|
||||||
|
"postcss.config.ts",
|
||||||
"file.ts"
|
"file.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|
|
@ -101,15 +101,23 @@ export const config = async (target: "web" | "client"): Promise<Configuration &
|
||||||
|
|
||||||
new CopyWebpackPlugin({
|
new CopyWebpackPlugin({
|
||||||
patterns: [
|
patterns: [
|
||||||
{ from: path.join(__dirname, "shared", "img"), to: 'img' },
|
{
|
||||||
{ from: path.join(__dirname, "shared", "i18n"), to: 'i18n' },
|
from: path.join(__dirname, "shared", "img"),
|
||||||
|
to: 'img',
|
||||||
|
globOptions: {
|
||||||
|
ignore: [
|
||||||
|
'**/client-icons/**',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
target === "web" ? { from: path.join(__dirname, "shared", "i18n"), to: 'i18n' } : undefined,
|
||||||
{ from: path.join(__dirname, "shared", "audio"), to: 'audio' }
|
{ from: path.join(__dirname, "shared", "audio"), to: 'audio' }
|
||||||
]
|
].filter(e => !!e)
|
||||||
}),
|
}),
|
||||||
|
|
||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: isDevelopment ? "[name].[contenthash].css" : "[contenthash].css",
|
filename: isDevelopment ? "css/[name].[contenthash].css" : "css/[contenthash].css",
|
||||||
chunkFilename: isDevelopment ? "[name].[contenthash].css" : "[contenthash].css",
|
chunkFilename: isDevelopment ? "css/[name].[contenthash].css" : "css/[contenthash].css",
|
||||||
ignoreOrder: true,
|
ignoreOrder: true,
|
||||||
|
|
||||||
}),
|
}),
|
||||||
|
@ -120,7 +128,7 @@ export const config = async (target: "web" | "client"): Promise<Configuration &
|
||||||
}),
|
}),
|
||||||
new SvgSpriteGenerator({
|
new SvgSpriteGenerator({
|
||||||
dtsOutputFolder: path.join(__dirname, "shared", "svg-sprites"),
|
dtsOutputFolder: path.join(__dirname, "shared", "svg-sprites"),
|
||||||
publicPath: "js/",
|
publicPath: "/assets/",
|
||||||
configurations: {
|
configurations: {
|
||||||
"client-icons": {
|
"client-icons": {
|
||||||
folder: path.join(__dirname, "shared", "img", "client-icons"),
|
folder: path.join(__dirname, "shared", "img", "client-icons"),
|
||||||
|
@ -241,7 +249,10 @@ export const config = async (target: "web" | "client"): Promise<Configuration &
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: /\.(png|jpg|jpeg|gif)?$/,
|
test: /\.(png|jpg|jpeg|gif)?$/,
|
||||||
type: "asset/resource"
|
type: "asset/resource",
|
||||||
|
generator: {
|
||||||
|
filename: 'img/[hash][ext][query]'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
} as any,
|
} as any,
|
||||||
|
@ -257,10 +268,10 @@ export const config = async (target: "web" | "client"): Promise<Configuration &
|
||||||
{"tc-loader": "window loader"}
|
{"tc-loader": "window loader"}
|
||||||
],
|
],
|
||||||
output: {
|
output: {
|
||||||
filename: isDevelopment ? "[name].[contenthash].js" : "[contenthash].js",
|
filename: isDevelopment ? "js/[name].[contenthash].js" : "js/[contenthash].js",
|
||||||
chunkFilename: isDevelopment ? "[name].[contenthash].js" : "[contenthash].js",
|
chunkFilename: isDevelopment ? "js/[name].[contenthash].js" : "js/[contenthash].js",
|
||||||
path: path.resolve(__dirname, 'dist'),
|
path: path.resolve(__dirname, "dist"),
|
||||||
publicPath: "/js/"
|
publicPath: "/"
|
||||||
},
|
},
|
||||||
performance: {
|
performance: {
|
||||||
hints: false
|
hints: false
|
||||||
|
@ -277,7 +288,7 @@ export const config = async (target: "web" | "client"): Promise<Configuration &
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
publicPath: "/js/",
|
publicPath: "/",
|
||||||
contentBase: path.join(__dirname, 'dist'),
|
contentBase: path.join(__dirname, 'dist'),
|
||||||
writeToDisk: true,
|
writeToDisk: true,
|
||||||
compress: true,
|
compress: true,
|
||||||
|
|
Loading…
Add table
Reference in a new issue