mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-13 11:00:01 +00:00
Split React into separate chunk to reduce bundle sizes
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<link rel="stylesheet" href="index.css">
|
<link rel="stylesheet" href="index.css">
|
||||||
|
<script src="../vendor.js" defer></script>
|
||||||
<script src="bundle.js" defer></script>
|
<script src="bundle.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<link rel="stylesheet" href="styles/index.css">
|
<link rel="stylesheet" href="styles/index.css">
|
||||||
|
<script src="../vendor.js" defer></script>
|
||||||
<script src="bundle.js" defer></script>
|
<script src="bundle.js" defer></script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -23,6 +23,17 @@ module.exports = (env) => ({
|
|||||||
filename: "[name].js"
|
filename: "[name].js"
|
||||||
, path: `${env.outputPath}`
|
, path: `${env.outputPath}`
|
||||||
}
|
}
|
||||||
|
, optimization: {
|
||||||
|
splitChunks: {
|
||||||
|
cacheGroups: {
|
||||||
|
vendor: {
|
||||||
|
name: "vendor"
|
||||||
|
, test: /[\\/]node_modules[\\/](react|react-dom)[\\/]/
|
||||||
|
, chunks: "all"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
, plugins: [
|
, plugins: [
|
||||||
new webpack.DefinePlugin({
|
new webpack.DefinePlugin({
|
||||||
"EXTENSION_NAME" : JSON.stringify(env.extensionName)
|
"EXTENSION_NAME" : JSON.stringify(env.extensionName)
|
||||||
|
|||||||
Reference in New Issue
Block a user