@rushstack/heft-web-rig 0.19.6 → 0.19.7
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/LICENSE +24 -24
- package/README.md +35 -35
- package/package.json +5 -5
- package/profiles/app/config/heft.json +68 -68
- package/profiles/app/config/jest.config.json +3 -3
- package/profiles/app/config/rush-project.json +12 -12
- package/profiles/app/config/sass.json +65 -65
- package/profiles/app/config/typescript.json +98 -98
- package/profiles/app/includes/eslint/mixins/friendly-locals.js +6 -6
- package/profiles/app/includes/eslint/mixins/packlets.js +6 -6
- package/profiles/app/includes/eslint/mixins/react.js +6 -6
- package/profiles/app/includes/eslint/mixins/tsdoc.js +6 -6
- package/profiles/app/includes/eslint/patch/custom-config-package-names.js +4 -4
- package/profiles/app/includes/eslint/patch/modern-module-resolution.js +4 -4
- package/profiles/app/includes/eslint/profile/web-app.js +6 -6
- package/profiles/app/tsconfig-base.json +34 -34
- package/profiles/app/webpack-base.config.js +39 -39
- package/profiles/library/config/api-extractor-task.json +27 -27
- package/profiles/library/config/heft.json +68 -68
- package/profiles/library/config/jest.config.json +3 -3
- package/profiles/library/config/rush-project.json +12 -12
- package/profiles/library/config/sass.json +65 -65
- package/profiles/library/config/typescript.json +98 -98
- package/profiles/library/includes/eslint/mixins/friendly-locals.js +6 -6
- package/profiles/library/includes/eslint/mixins/packlets.js +6 -6
- package/profiles/library/includes/eslint/mixins/react.js +6 -6
- package/profiles/library/includes/eslint/mixins/tsdoc.js +6 -6
- package/profiles/library/includes/eslint/patch/custom-config-package-names.js +4 -4
- package/profiles/library/includes/eslint/patch/modern-module-resolution.js +4 -4
- package/profiles/library/includes/eslint/profile/web-app.js +6 -6
- package/profiles/library/tsconfig-base.json +34 -34
- package/profiles/library/webpack-base.config.js +50 -50
- package/shared/webpack-base.config.js +273 -273
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
|
|
3
|
-
*/
|
|
4
|
-
{
|
|
5
|
-
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json",
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Optionally specifies another JSON config file that this file extends from. This provides a way for standard
|
|
9
|
-
* settings to be shared across multiple projects.
|
|
10
|
-
*/
|
|
11
|
-
// "extends": "base-project/config/typescript.json",
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* If provided, emit these module kinds in addition to the modules specified in the tsconfig.
|
|
15
|
-
* Note that this option only applies to the main tsconfig.json configuration.
|
|
16
|
-
*/
|
|
17
|
-
"additionalModuleKindsToEmit": [
|
|
18
|
-
// {
|
|
19
|
-
// /**
|
|
20
|
-
// * (Required) Must be one of "commonjs", "amd", "umd", "system", "es2015", "esnext"
|
|
21
|
-
// */
|
|
22
|
-
// "moduleKind": "amd",
|
|
23
|
-
//
|
|
24
|
-
// /**
|
|
25
|
-
// * (Required) The name of the folder where the output will be written.
|
|
26
|
-
// */
|
|
27
|
-
// "outFolderName": "lib-amd"
|
|
28
|
-
// }
|
|
29
|
-
|
|
30
|
-
{
|
|
31
|
-
"moduleKind": "commonjs",
|
|
32
|
-
"outFolderName": "lib-commonjs"
|
|
33
|
-
}
|
|
34
|
-
],
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* If true, emit CommonJS module output to the folder specified in the tsconfig "outDir" compiler option with the .cjs extension alongside (or instead of, if TSConfig specifies CommonJS) the default compilation output.
|
|
38
|
-
*/
|
|
39
|
-
// "emitCjsExtensionForCommonJS": true,
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* If true, emit ESNext module output to the folder specified in the tsconfig "outDir" compiler option with the .mjs extension alongside (or instead of, if TSConfig specifies ESNext) the default compilation output.
|
|
43
|
-
*/
|
|
44
|
-
// "emitMjsExtensionForESModule": true,
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* If true and "isolatedModules" is configured in tsconfig.json, use a worker thread to run transpilation concurrently with type checking and declaration emit.
|
|
48
|
-
*/
|
|
49
|
-
// "useTranspilerWorker": true
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example
|
|
53
|
-
* so that these files can be resolved by import statements.
|
|
54
|
-
*/
|
|
55
|
-
"staticAssetsToCopy": {
|
|
56
|
-
/**
|
|
57
|
-
* File extensions that should be copied from the src folder to the destination folder(s).
|
|
58
|
-
*/
|
|
59
|
-
"fileExtensions": [
|
|
60
|
-
".aac",
|
|
61
|
-
".css",
|
|
62
|
-
".eot",
|
|
63
|
-
".gif",
|
|
64
|
-
".jpeg",
|
|
65
|
-
".jpg",
|
|
66
|
-
".json",
|
|
67
|
-
".m4a",
|
|
68
|
-
".mp3",
|
|
69
|
-
".mp4",
|
|
70
|
-
".oga",
|
|
71
|
-
".otf",
|
|
72
|
-
".png",
|
|
73
|
-
".scss",
|
|
74
|
-
".svg",
|
|
75
|
-
".ttf",
|
|
76
|
-
".wav",
|
|
77
|
-
".webm",
|
|
78
|
-
".webp",
|
|
79
|
-
".woff",
|
|
80
|
-
".woff2"
|
|
81
|
-
]
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Glob patterns that should be explicitly included.
|
|
85
|
-
*/
|
|
86
|
-
// "includeGlobs": [
|
|
87
|
-
// "some/path/*.js"
|
|
88
|
-
// ],
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Glob patterns that should be explicitly excluded. This takes precedence over globs listed
|
|
92
|
-
* in "includeGlobs" and files that match the file extensions provided in "fileExtensions".
|
|
93
|
-
*/
|
|
94
|
-
// "excludeGlobs": [
|
|
95
|
-
// "some/path/*.css"
|
|
96
|
-
// ]
|
|
97
|
-
}
|
|
98
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Configures the TypeScript plugin for Heft. This plugin also manages linting.
|
|
3
|
+
*/
|
|
4
|
+
{
|
|
5
|
+
"$schema": "https://developer.microsoft.com/json-schemas/heft/v0/typescript.schema.json",
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Optionally specifies another JSON config file that this file extends from. This provides a way for standard
|
|
9
|
+
* settings to be shared across multiple projects.
|
|
10
|
+
*/
|
|
11
|
+
// "extends": "base-project/config/typescript.json",
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* If provided, emit these module kinds in addition to the modules specified in the tsconfig.
|
|
15
|
+
* Note that this option only applies to the main tsconfig.json configuration.
|
|
16
|
+
*/
|
|
17
|
+
"additionalModuleKindsToEmit": [
|
|
18
|
+
// {
|
|
19
|
+
// /**
|
|
20
|
+
// * (Required) Must be one of "commonjs", "amd", "umd", "system", "es2015", "esnext"
|
|
21
|
+
// */
|
|
22
|
+
// "moduleKind": "amd",
|
|
23
|
+
//
|
|
24
|
+
// /**
|
|
25
|
+
// * (Required) The name of the folder where the output will be written.
|
|
26
|
+
// */
|
|
27
|
+
// "outFolderName": "lib-amd"
|
|
28
|
+
// }
|
|
29
|
+
|
|
30
|
+
{
|
|
31
|
+
"moduleKind": "commonjs",
|
|
32
|
+
"outFolderName": "lib-commonjs"
|
|
33
|
+
}
|
|
34
|
+
],
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* If true, emit CommonJS module output to the folder specified in the tsconfig "outDir" compiler option with the .cjs extension alongside (or instead of, if TSConfig specifies CommonJS) the default compilation output.
|
|
38
|
+
*/
|
|
39
|
+
// "emitCjsExtensionForCommonJS": true,
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* If true, emit ESNext module output to the folder specified in the tsconfig "outDir" compiler option with the .mjs extension alongside (or instead of, if TSConfig specifies ESNext) the default compilation output.
|
|
43
|
+
*/
|
|
44
|
+
// "emitMjsExtensionForESModule": true,
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* If true and "isolatedModules" is configured in tsconfig.json, use a worker thread to run transpilation concurrently with type checking and declaration emit.
|
|
48
|
+
*/
|
|
49
|
+
// "useTranspilerWorker": true
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Configures additional file types that should be copied into the TypeScript compiler's emit folders, for example
|
|
53
|
+
* so that these files can be resolved by import statements.
|
|
54
|
+
*/
|
|
55
|
+
"staticAssetsToCopy": {
|
|
56
|
+
/**
|
|
57
|
+
* File extensions that should be copied from the src folder to the destination folder(s).
|
|
58
|
+
*/
|
|
59
|
+
"fileExtensions": [
|
|
60
|
+
".aac",
|
|
61
|
+
".css",
|
|
62
|
+
".eot",
|
|
63
|
+
".gif",
|
|
64
|
+
".jpeg",
|
|
65
|
+
".jpg",
|
|
66
|
+
".json",
|
|
67
|
+
".m4a",
|
|
68
|
+
".mp3",
|
|
69
|
+
".mp4",
|
|
70
|
+
".oga",
|
|
71
|
+
".otf",
|
|
72
|
+
".png",
|
|
73
|
+
".scss",
|
|
74
|
+
".svg",
|
|
75
|
+
".ttf",
|
|
76
|
+
".wav",
|
|
77
|
+
".webm",
|
|
78
|
+
".webp",
|
|
79
|
+
".woff",
|
|
80
|
+
".woff2"
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Glob patterns that should be explicitly included.
|
|
85
|
+
*/
|
|
86
|
+
// "includeGlobs": [
|
|
87
|
+
// "some/path/*.js"
|
|
88
|
+
// ],
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Glob patterns that should be explicitly excluded. This takes precedence over globs listed
|
|
92
|
+
* in "includeGlobs" and files that match the file extensions provided in "fileExtensions".
|
|
93
|
+
*/
|
|
94
|
+
// "excludeGlobs": [
|
|
95
|
+
// "some/path/*.css"
|
|
96
|
+
// ]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['@rushstack/eslint-config/mixins/friendly-locals']
|
|
6
|
-
};
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
extends: ['@rushstack/eslint-config/mixins/friendly-locals']
|
|
6
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['@rushstack/eslint-config/mixins/packlets']
|
|
6
|
-
};
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
extends: ['@rushstack/eslint-config/mixins/packlets']
|
|
6
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['@rushstack/eslint-config/mixins/react']
|
|
6
|
-
};
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
extends: ['@rushstack/eslint-config/mixins/react']
|
|
6
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['@rushstack/eslint-config/mixins/tsdoc']
|
|
6
|
-
};
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
extends: ['@rushstack/eslint-config/mixins/tsdoc']
|
|
6
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
require('@rushstack/eslint-config/patch/custom-config-package-names');
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
require('@rushstack/eslint-config/patch/custom-config-package-names');
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
require('@rushstack/eslint-config/patch/modern-module-resolution');
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
require('@rushstack/eslint-config/patch/modern-module-resolution');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
-
// See LICENSE in the project root for license information.
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
extends: ['@rushstack/eslint-config/profile/web-app']
|
|
6
|
-
};
|
|
1
|
+
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
|
|
2
|
+
// See LICENSE in the project root for license information.
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
extends: ['@rushstack/eslint-config/profile/web-app']
|
|
6
|
+
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json.schemastore.org/tsconfig",
|
|
3
|
-
|
|
4
|
-
"compilerOptions": {
|
|
5
|
-
"outDir": "../../../../../lib",
|
|
6
|
-
"rootDir": "../../../../../src",
|
|
7
|
-
"rootDirs": ["../../../../../src", "../../../../../temp/sass-ts"],
|
|
8
|
-
|
|
9
|
-
"forceConsistentCasingInFileNames": true,
|
|
10
|
-
"jsx": "react",
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"declarationMap": true,
|
|
14
|
-
"inlineSources": true,
|
|
15
|
-
"experimentalDecorators": true,
|
|
16
|
-
"strict": true,
|
|
17
|
-
"useUnknownInCatchVariables": false,
|
|
18
|
-
"esModuleInterop": true,
|
|
19
|
-
"noEmitOnError": false,
|
|
20
|
-
"allowUnreachableCode": false,
|
|
21
|
-
"importHelpers": true,
|
|
22
|
-
|
|
23
|
-
"types": ["heft-jest"],
|
|
24
|
-
"typeRoots": ["../../../../../node_modules/@types", "../../node_modules/@types"],
|
|
25
|
-
|
|
26
|
-
"module": "esnext",
|
|
27
|
-
"moduleResolution": "node",
|
|
28
|
-
"target": "es5",
|
|
29
|
-
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"],
|
|
30
|
-
|
|
31
|
-
"incremental": true
|
|
32
|
-
},
|
|
33
|
-
"include": ["../../../../../src/**/*.ts", "../../../../../src/**/*.tsx"]
|
|
34
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json.schemastore.org/tsconfig",
|
|
3
|
+
|
|
4
|
+
"compilerOptions": {
|
|
5
|
+
"outDir": "../../../../../lib",
|
|
6
|
+
"rootDir": "../../../../../src",
|
|
7
|
+
"rootDirs": ["../../../../../src", "../../../../../temp/sass-ts"],
|
|
8
|
+
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"jsx": "react",
|
|
11
|
+
"declaration": true,
|
|
12
|
+
"sourceMap": true,
|
|
13
|
+
"declarationMap": true,
|
|
14
|
+
"inlineSources": true,
|
|
15
|
+
"experimentalDecorators": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"useUnknownInCatchVariables": false,
|
|
18
|
+
"esModuleInterop": true,
|
|
19
|
+
"noEmitOnError": false,
|
|
20
|
+
"allowUnreachableCode": false,
|
|
21
|
+
"importHelpers": true,
|
|
22
|
+
|
|
23
|
+
"types": ["heft-jest"],
|
|
24
|
+
"typeRoots": ["../../../../../node_modules/@types", "../../node_modules/@types"],
|
|
25
|
+
|
|
26
|
+
"module": "esnext",
|
|
27
|
+
"moduleResolution": "node",
|
|
28
|
+
"target": "es5",
|
|
29
|
+
"lib": ["es5", "scripthost", "es2015.collection", "es2015.promise", "es2015.iterable", "dom"],
|
|
30
|
+
|
|
31
|
+
"incremental": true
|
|
32
|
+
},
|
|
33
|
+
"include": ["../../../../../src/**/*.ts", "../../../../../src/**/*.tsx"]
|
|
34
|
+
}
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
const createWebpackConfigCommon = require('../../shared/webpack-base.config');
|
|
5
|
-
|
|
6
|
-
module.exports = function createWebpackConfig({ env, argv, projectRoot, configOverride }) {
|
|
7
|
-
// Example: "@my-company/my-library"
|
|
8
|
-
const packageName = require(path.join(projectRoot, 'package.json')).name;
|
|
9
|
-
// Example: "my-library"
|
|
10
|
-
const packageNameWithoutScope = packageName.split('/').pop();
|
|
11
|
-
|
|
12
|
-
// Documentation: https://webpack.js.org/configuration/
|
|
13
|
-
const libraryOverrides = {
|
|
14
|
-
target: ['web', 'es5'],
|
|
15
|
-
entry: {
|
|
16
|
-
// Rush Stack convention is that the entry point for libraries is "src/index.ts"
|
|
17
|
-
// whereas the entry point for apps is "src/start.ts"
|
|
18
|
-
[packageNameWithoutScope]: path.resolve(projectRoot, 'lib', 'index.js')
|
|
19
|
-
},
|
|
20
|
-
output: {
|
|
21
|
-
// For libraries, the filename is unhashed so that the package.json "main" field can refer to it
|
|
22
|
-
filename: `[name].js`,
|
|
23
|
-
library: {
|
|
24
|
-
// Use the full package name as the module-id name for AMD
|
|
25
|
-
amd: packageName
|
|
26
|
-
},
|
|
27
|
-
libraryTarget: 'umd',
|
|
28
|
-
|
|
29
|
-
// https://webpack.js.org/configuration/output/#outputlibraryumdnameddefine
|
|
30
|
-
// Give the amd module a globally unique id so that non AMD aware bundlers can concatenate the module
|
|
31
|
-
umdNamedDefine: true,
|
|
32
|
-
|
|
33
|
-
// From: https://webpack.js.org/configuration/output/#outputglobalobject
|
|
34
|
-
// To make UMD build available on both browsers and Node.js, set output.globalObject option to 'this'
|
|
35
|
-
globalObject: 'this'
|
|
36
|
-
},
|
|
37
|
-
devtool: 'source-map'
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
return createWebpackConfigCommon({
|
|
41
|
-
env: env,
|
|
42
|
-
argv: argv,
|
|
43
|
-
projectRoot: projectRoot,
|
|
44
|
-
// "If you're building a design system or component library and shipping to NPM you shouldn't
|
|
45
|
-
// extract just yet, let your consumers do it in their app."
|
|
46
|
-
// https://compiledcssinjs.com/docs/css-extraction-webpack
|
|
47
|
-
extractCssInProduction: false,
|
|
48
|
-
configOverride: createWebpackConfigCommon.merge(libraryOverrides, configOverride)
|
|
49
|
-
});
|
|
50
|
-
};
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const createWebpackConfigCommon = require('../../shared/webpack-base.config');
|
|
5
|
+
|
|
6
|
+
module.exports = function createWebpackConfig({ env, argv, projectRoot, configOverride }) {
|
|
7
|
+
// Example: "@my-company/my-library"
|
|
8
|
+
const packageName = require(path.join(projectRoot, 'package.json')).name;
|
|
9
|
+
// Example: "my-library"
|
|
10
|
+
const packageNameWithoutScope = packageName.split('/').pop();
|
|
11
|
+
|
|
12
|
+
// Documentation: https://webpack.js.org/configuration/
|
|
13
|
+
const libraryOverrides = {
|
|
14
|
+
target: ['web', 'es5'],
|
|
15
|
+
entry: {
|
|
16
|
+
// Rush Stack convention is that the entry point for libraries is "src/index.ts"
|
|
17
|
+
// whereas the entry point for apps is "src/start.ts"
|
|
18
|
+
[packageNameWithoutScope]: path.resolve(projectRoot, 'lib', 'index.js')
|
|
19
|
+
},
|
|
20
|
+
output: {
|
|
21
|
+
// For libraries, the filename is unhashed so that the package.json "main" field can refer to it
|
|
22
|
+
filename: `[name].js`,
|
|
23
|
+
library: {
|
|
24
|
+
// Use the full package name as the module-id name for AMD
|
|
25
|
+
amd: packageName
|
|
26
|
+
},
|
|
27
|
+
libraryTarget: 'umd',
|
|
28
|
+
|
|
29
|
+
// https://webpack.js.org/configuration/output/#outputlibraryumdnameddefine
|
|
30
|
+
// Give the amd module a globally unique id so that non AMD aware bundlers can concatenate the module
|
|
31
|
+
umdNamedDefine: true,
|
|
32
|
+
|
|
33
|
+
// From: https://webpack.js.org/configuration/output/#outputglobalobject
|
|
34
|
+
// To make UMD build available on both browsers and Node.js, set output.globalObject option to 'this'
|
|
35
|
+
globalObject: 'this'
|
|
36
|
+
},
|
|
37
|
+
devtool: 'source-map'
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
return createWebpackConfigCommon({
|
|
41
|
+
env: env,
|
|
42
|
+
argv: argv,
|
|
43
|
+
projectRoot: projectRoot,
|
|
44
|
+
// "If you're building a design system or component library and shipping to NPM you shouldn't
|
|
45
|
+
// extract just yet, let your consumers do it in their app."
|
|
46
|
+
// https://compiledcssinjs.com/docs/css-extraction-webpack
|
|
47
|
+
extractCssInProduction: false,
|
|
48
|
+
configOverride: createWebpackConfigCommon.merge(libraryOverrides, configOverride)
|
|
49
|
+
});
|
|
50
|
+
};
|