sku 11.0.4 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/config/webpack/webpack.config.js +15 -12
- package/config/webpack/webpack.config.ssr.js +15 -11
- package/context/configSchema.js +3 -0
- package/context/defaultSkuConfig.js +1 -0
- package/context/index.js +1 -0
- package/docs/docs/configuration.md +8 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# sku
|
|
2
2
|
|
|
3
|
+
## 11.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Include node_modules in node builds ([#651](https://github.com/seek-oss/sku/pull/651))
|
|
8
|
+
|
|
9
|
+
Previously, sku would only compile code within your src folder, plus any compile packages, for builds targetting the node environment. While this results in faster builds, it can sometimes lead to incorrect versions of packages being resolved due to clashing version range requirements. All node_modules will now included in the compilation by default, ensuring the correct package version is always required.
|
|
10
|
+
|
|
11
|
+
The old behaviour can be re-enabled via the new `externalizeNodeModules` config.
|
|
12
|
+
|
|
3
13
|
## 11.0.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -39,6 +39,7 @@ const {
|
|
|
39
39
|
cspExtraScriptSrcHosts,
|
|
40
40
|
rootResolution,
|
|
41
41
|
skipPackageCompatibilityCompilation,
|
|
42
|
+
externalizeNodeModules,
|
|
42
43
|
} = config;
|
|
43
44
|
|
|
44
45
|
// port is only required for dev builds
|
|
@@ -268,19 +269,21 @@ const makeWebpackConfig = ({
|
|
|
268
269
|
// render will run within the same process
|
|
269
270
|
target: `browserslist:${nodeTarget}`,
|
|
270
271
|
externals: [
|
|
271
|
-
// Don't bundle or transpile non-compiled packages
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
272
|
+
// Don't bundle or transpile non-compiled packages if externalizeNodeModules is enabled
|
|
273
|
+
externalizeNodeModules
|
|
274
|
+
? nodeExternals({
|
|
275
|
+
allowlist: [
|
|
276
|
+
'classnames', // Workaround for https://github.com/JedWatson/classnames/issues/240
|
|
275
277
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
278
|
+
// webpack-node-externals compares the `import` or `require` expression to this list,
|
|
279
|
+
// not the package name, so we map each packageName to a pattern. This ensures it
|
|
280
|
+
// matches when importing a file within a package e.g. import { Text } from 'seek-style-guide/react'.
|
|
281
|
+
...paths.compilePackages.map(
|
|
282
|
+
(packageName) => new RegExp(`^(${packageName})`),
|
|
283
|
+
),
|
|
284
|
+
],
|
|
285
|
+
})
|
|
286
|
+
: {},
|
|
284
287
|
],
|
|
285
288
|
output: {
|
|
286
289
|
path: paths.target,
|
|
@@ -30,6 +30,7 @@ const {
|
|
|
30
30
|
useDevServerMiddleware,
|
|
31
31
|
rootResolution,
|
|
32
32
|
skipPackageCompatibilityCompilation,
|
|
33
|
+
externalizeNodeModules,
|
|
33
34
|
} = require('../../context');
|
|
34
35
|
const { getVocabConfig } = require('../vocab/vocab');
|
|
35
36
|
const statsConfig = require('./statsConfig');
|
|
@@ -225,17 +226,20 @@ const makeWebpackConfig = ({
|
|
|
225
226
|
{
|
|
226
227
|
__sku_alias__webpackStats: `commonjs ./${webpackStatsFilename}`,
|
|
227
228
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
229
|
+
// Don't bundle or transpile non-compiled packages if externalizeNodeModules is enabled
|
|
230
|
+
externalizeNodeModules
|
|
231
|
+
? nodeExternals({
|
|
232
|
+
modulesDir: findUp.sync('node_modules'), // Allow usage within project subdirectories (required for tests)
|
|
233
|
+
allowlist: [
|
|
234
|
+
// webpack-node-externals compares the `import` or `require` expression to this list,
|
|
235
|
+
// not the package name, so we map each packageName to a pattern. This ensures it
|
|
236
|
+
// matches when importing a file within a package e.g. import { Text } from 'seek-style-guide/react'.
|
|
237
|
+
...paths.compilePackages.map(
|
|
238
|
+
(packageName) => new RegExp(`^(${packageName})`),
|
|
239
|
+
),
|
|
240
|
+
],
|
|
241
|
+
})
|
|
242
|
+
: {},
|
|
239
243
|
],
|
|
240
244
|
resolve: {
|
|
241
245
|
alias: {
|
package/context/configSchema.js
CHANGED
package/context/index.js
CHANGED
|
@@ -143,6 +143,14 @@ Default: `[]`
|
|
|
143
143
|
|
|
144
144
|
An array of environments the app supports. Apps should have one environment for local development plus one for each environment they're deployed to. Use this value to drive app config (e.g. `analyticsEnabled` or `apiEndpoint`). See [static-rendering](./docs/static-rendering.md) for more info.
|
|
145
145
|
|
|
146
|
+
## externalizeNodeModules
|
|
147
|
+
|
|
148
|
+
type `boolean`
|
|
149
|
+
|
|
150
|
+
Default: `false`
|
|
151
|
+
|
|
152
|
+
By default, sku compiles all node_modules in builds that target node. Setting this option to `true` will instead externalize all node_modules, excluding `compilePackages`.
|
|
153
|
+
|
|
146
154
|
## skipPackageCompatibilityCompilation
|
|
147
155
|
|
|
148
156
|
type `Array<string>`
|