Skip to content

Commit 578e0f4

Browse files
committed
Extracting shared resources out to a bootstrap file
1 parent 3c588a2 commit 578e0f4

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/base.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,24 @@ export default function webpackConfigFactory(args: any): webpack.Configuration {
175175
];
176176
return entry;
177177
}, {}),
178+
optimization: {
179+
splitChunks: {
180+
cacheGroups: {
181+
default: false,
182+
vendors: false,
183+
184+
common: {
185+
name: 'bootstrap',
186+
minChunks: 2,
187+
chunks: 'all',
188+
priority: 10,
189+
reuseExistingChunk: true,
190+
enforce: true,
191+
test: ({ resource }) => /node_modules/.test(resource)
192+
}
193+
}
194+
}
195+
},
178196
node: { dgram: 'empty', net: 'empty', tls: 'empty', fs: 'empty' },
179197
output: {
180198
chunkFilename: isLib ? '[name].js' : `[name]-${packageJson.version}.js`,

test-app/src/evergreen.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<title>custom-element</title>
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<script src="../../node_modules/@webcomponents/custom-elements/custom-elements.min.js"></script>
7+
<script src="./bootstrap-1.0.0.js"></script>
78
<script src="./menu-1.0.0.js"></script>
89
<script src="./menu-item-1.0.0.js"></script>
910
<link rel="stylesheet" href="./menu-1.0.0.css" />

test-app/src/legacy.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta name="viewport" content="width=device-width, initial-scale=1">
66
<script src="../../node_modules/@webcomponents/custom-elements/custom-elements.min.js"></script>
77
<script src="../../node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js"></script>
8+
<script src="./bootstrap-1.0.0.js"></script>
89
<script src="./menu-1.0.0.js"></script>
910
<script src="./menu-item-1.0.0.js"></script>
1011
<link rel="stylesheet" href="./menu-1.0.0.css" />

0 commit comments

Comments
 (0)