@modern-js/plugin-docsite 1.1.0 → 1.1.3
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 +29 -71
- package/dist/js/modern/build-task.js +9 -1
- package/dist/js/modern/features/utils/generate-files.js +2 -2
- package/dist/js/modern/features/utils/webpack.js +33 -15
- package/dist/js/node/build-task.js +9 -1
- package/dist/js/node/features/utils/generate-files.js +2 -2
- package/dist/js/node/features/utils/webpack.js +33 -15
- package/dist/types/index.d.ts +3 -0
- package/package.json +12 -10
- package/src/build-task.ts +6 -2
- package/src/features/utils/webpack.ts +39 -29
package/CHANGELOG.md
CHANGED
@@ -1,87 +1,45 @@
|
|
1
1
|
# @modern-js/plugin-docsite
|
2
2
|
|
3
|
-
## 1.1.
|
4
|
-
|
5
|
-
### Minor Changes
|
6
|
-
|
7
|
-
- 96119db2: Relese v1.1.0
|
8
|
-
|
9
|
-
1. 全面支持 Windows 平台
|
10
|
-
|
11
|
-
ISSUE:
|
12
|
-
|
13
|
-
- [182](https://github.com/modern-js-dev/modern.js/issues/182)
|
14
|
-
- [236](https://github.com/modern-js-dev/modern.js/issues/236)
|
15
|
-
|
16
|
-
PR
|
17
|
-
|
18
|
-
- [219](https://github.com/modern-js-dev/modern.js/pull/219)
|
19
|
-
- [247](https://github.com/modern-js-dev/modern.js/pull/247)
|
20
|
-
- [249](https://github.com/modern-js-dev/modern.js/pull/249)
|
21
|
-
- [253](https://github.com/modern-js-dev/modern.js/pull/253)
|
22
|
-
- [268](https://github.com/modern-js-dev/modern.js/pull/268)
|
23
|
-
- [270](https://github.com/modern-js-dev/modern.js/pull/270)
|
24
|
-
- [273](https://github.com/modern-js-dev/modern.js/pull/273)
|
25
|
-
- [276](https://github.com/modern-js-dev/modern.js/pull/276)
|
26
|
-
|
27
|
-
2. 修复 Unbundled 模式启用问题
|
28
|
-
|
29
|
-
ISSUE
|
30
|
-
|
31
|
-
- [186](https://github.com/modern-js-dev/modern.js/issues/186)
|
32
|
-
- [224](https://github.com/modern-js-dev/modern.js/issues/224)
|
33
|
-
- [225](https://github.com/modern-js-dev/modern.js/issues/225)
|
34
|
-
- [238](https://github.com/modern-js-dev/modern.js/issues/238)
|
35
|
-
|
36
|
-
PR
|
37
|
-
|
38
|
-
- [226](https://github.com/modern-js-dev/modern.js/pull/226)
|
39
|
-
- [264](https://github.com/modern-js-dev/modern.js/pull/264)
|
40
|
-
- [codesmith-12](https://github.com/modern-js-dev/codesmith/pull/12)
|
41
|
-
|
42
|
-
3. 修复模块工程方案 .npmignore 文件初始化未生成
|
3
|
+
## 1.1.3
|
43
4
|
|
44
|
-
|
45
|
-
|
46
|
-
- [198](https://github.com/modern-js-dev/modern.js/issues/198)
|
47
|
-
|
48
|
-
PR
|
49
|
-
|
50
|
-
- [209](https://github.com/modern-js-dev/modern.js/pull/209)
|
51
|
-
|
52
|
-
4. 修复 Storybook 使用时浏览器打开页面报错
|
53
|
-
|
54
|
-
ISSUE
|
55
|
-
|
56
|
-
- [228](https://github.com/modern-js-dev/modern.js/issues/228)
|
57
|
-
|
58
|
-
PR
|
59
|
-
|
60
|
-
- [254](https://github.com/modern-js-dev/modern.js/pull/254)
|
61
|
-
|
62
|
-
5. 修复 BFF 一体化开发不支持 unbundle 模式
|
5
|
+
### Patch Changes
|
63
6
|
|
64
|
-
|
7
|
+
- ca7dcb32: add CORE_INIT_OPTION_FILE env
|
8
|
+
- Updated dependencies [90eeb72c]
|
9
|
+
- Updated dependencies [e04914ce]
|
10
|
+
- Updated dependencies [5a4c557e]
|
11
|
+
- Updated dependencies [e04914ce]
|
12
|
+
- Updated dependencies [ca7dcb32]
|
13
|
+
- Updated dependencies [ecb344dc]
|
14
|
+
- @modern-js/core@1.2.0
|
15
|
+
- @modern-js/utils@1.1.5
|
65
16
|
|
66
|
-
|
67
|
-
- [257](https://github.com/modern-js-dev/modern.js/issues/257)
|
17
|
+
## 1.1.2
|
68
18
|
|
69
|
-
|
19
|
+
### Patch Changes
|
70
20
|
|
71
|
-
|
72
|
-
- [271](https://github.com/modern-js-dev/modern.js/pull/271)
|
21
|
+
- fix missing dependencies bug
|
73
22
|
|
74
|
-
|
23
|
+
## 1.1.1
|
75
24
|
|
76
|
-
|
25
|
+
### Patch Changes
|
77
26
|
|
78
|
-
|
27
|
+
- 0fa83663: support more .env files
|
28
|
+
- Updated dependencies [6f7fe574]
|
29
|
+
- Updated dependencies [e4755134]
|
30
|
+
- Updated dependencies [0fa83663]
|
31
|
+
- Updated dependencies [19b4f79e]
|
32
|
+
- Updated dependencies [f594fbc8]
|
33
|
+
- Updated dependencies [d1fde77a]
|
34
|
+
- @modern-js/core@1.1.2
|
35
|
+
- @modern-js/webpack@1.1.2
|
36
|
+
- @modern-js/utils@1.1.2
|
79
37
|
|
80
|
-
|
38
|
+
## 1.1.0
|
81
39
|
|
82
|
-
|
40
|
+
### Minor Changes
|
83
41
|
|
84
|
-
### Patch Changes
|
42
|
+
- 96119db2: Relese v1.1.0### Patch Changes
|
85
43
|
|
86
44
|
- 6b802b2a: use path method from @modern-js/utils
|
87
45
|
- Updated dependencies [96119db2]
|
@@ -14,9 +14,17 @@ const taskMain = async ({
|
|
14
14
|
};
|
15
15
|
|
16
16
|
(async () => {
|
17
|
+
let options;
|
18
|
+
|
19
|
+
if (process.env.CORE_INIT_OPTION_FILE) {
|
20
|
+
({
|
21
|
+
options
|
22
|
+
} = require(process.env.CORE_INIT_OPTION_FILE));
|
23
|
+
}
|
24
|
+
|
17
25
|
const {
|
18
26
|
appContext
|
19
|
-
} = await core.cli.init();
|
27
|
+
} = await core.cli.init([], options);
|
20
28
|
await core.manager.run(async () => {
|
21
29
|
try {
|
22
30
|
await taskMain({
|
@@ -4,9 +4,9 @@ import _union from "lodash/union";
|
|
4
4
|
import _camelCase from "lodash/camelCase";
|
5
5
|
import _startCase from "lodash/startCase";
|
6
6
|
|
7
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
7
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
8
8
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
9
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
10
10
|
|
11
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
12
12
|
|
@@ -24,24 +24,42 @@ export function generatorWebpackConfig(appDirectory, tmpDir, isDev) {
|
|
24
24
|
templateContent: fs.readFileSync(path.resolve(UTILS_STATIC, 'index.html.ejs'), 'utf8')
|
25
25
|
})]
|
26
26
|
};
|
27
|
-
|
27
|
+
const docsiteNodeModules = [// for yarn
|
28
|
+
path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), // for pnpm
|
29
|
+
path.resolve(path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), '../..')]; // maybe check if outside appDir or monorepoDir
|
30
|
+
|
31
|
+
config.resolve.modules = [...(config.resolve.modules || []), ...docsiteNodeModules];
|
28
32
|
config.resolve.alias['@assets'] = path.resolve(appDirectory, 'assets');
|
29
33
|
config.resolve.alias['@styles'] = path.resolve(appDirectory, 'styles'); // fix this since react-live relies on core-js@2
|
30
34
|
|
31
|
-
config.resolve.alias[`${path.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es';
|
32
|
-
|
33
|
-
|
34
|
-
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
35
|
-
|
36
|
-
} else {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
35
|
+
config.resolve.alias[`${path.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es'; // const pkgJSON = JSON.parse(
|
36
|
+
// fs.readFileSync(path.join(appDirectory, 'package.json'), 'utf-8'),
|
37
|
+
// );
|
38
|
+
// if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
39
|
+
// (config.resolve!.alias as Alias).react = path.resolve('node_modules/react');
|
40
|
+
// } else {
|
41
|
+
// (config.resolve!.alias as Alias).react = path.resolve(
|
42
|
+
// __dirname,
|
43
|
+
// '../../../../../',
|
44
|
+
// 'node_modules',
|
45
|
+
// 'react',
|
46
|
+
// );
|
47
|
+
// }
|
48
|
+
// if (
|
49
|
+
// pkgJSON.dependencies['react-dom'] ||
|
50
|
+
// pkgJSON.devDependencies['react-dom']
|
51
|
+
// ) {
|
52
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
53
|
+
// 'node_modules/react-dom',
|
54
|
+
// );
|
55
|
+
// } else {
|
56
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
57
|
+
// __dirname,
|
58
|
+
// '../../../../../',
|
59
|
+
// 'node_modules',
|
60
|
+
// 'react-dom',
|
61
|
+
// );
|
62
|
+
// }
|
45
63
|
|
46
64
|
config.resolve.fallback = {
|
47
65
|
path: require.resolve('path-browserify')
|
@@ -18,9 +18,17 @@ const taskMain = async ({
|
|
18
18
|
};
|
19
19
|
|
20
20
|
(async () => {
|
21
|
+
let options;
|
22
|
+
|
23
|
+
if (process.env.CORE_INIT_OPTION_FILE) {
|
24
|
+
({
|
25
|
+
options
|
26
|
+
} = require(process.env.CORE_INIT_OPTION_FILE));
|
27
|
+
}
|
28
|
+
|
21
29
|
const {
|
22
30
|
appContext
|
23
|
-
} = await core.cli.init();
|
31
|
+
} = await core.cli.init([], options);
|
24
32
|
await core.manager.run(async () => {
|
25
33
|
try {
|
26
34
|
await taskMain({
|
@@ -39,9 +39,9 @@ var _constant = require("../constant");
|
|
39
39
|
|
40
40
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
41
41
|
|
42
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
42
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
43
43
|
|
44
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
44
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
45
45
|
|
46
46
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
47
47
|
|
@@ -40,24 +40,42 @@ function generatorWebpackConfig(appDirectory, tmpDir, isDev) {
|
|
40
40
|
templateContent: _utils.fs.readFileSync(_path.default.resolve(_constant.UTILS_STATIC, 'index.html.ejs'), 'utf8')
|
41
41
|
})]
|
42
42
|
};
|
43
|
-
|
43
|
+
const docsiteNodeModules = [// for yarn
|
44
|
+
_path.default.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), // for pnpm
|
45
|
+
_path.default.resolve(_path.default.dirname(require.resolve('@modern-js/plugin-docsite/package.json')), '../..')]; // maybe check if outside appDir or monorepoDir
|
46
|
+
|
47
|
+
config.resolve.modules = [...(config.resolve.modules || []), ...docsiteNodeModules];
|
44
48
|
config.resolve.alias['@assets'] = _path.default.resolve(appDirectory, 'assets');
|
45
49
|
config.resolve.alias['@styles'] = _path.default.resolve(appDirectory, 'styles'); // fix this since react-live relies on core-js@2
|
46
50
|
|
47
|
-
config.resolve.alias[`${_path.default.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es';
|
48
|
-
|
49
|
-
|
50
|
-
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
51
|
-
|
52
|
-
} else {
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
51
|
+
config.resolve.alias[`${_path.default.dirname(require.resolve('core-js'))}/fn`] = 'core-js/es'; // const pkgJSON = JSON.parse(
|
52
|
+
// fs.readFileSync(path.join(appDirectory, 'package.json'), 'utf-8'),
|
53
|
+
// );
|
54
|
+
// if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
55
|
+
// (config.resolve!.alias as Alias).react = path.resolve('node_modules/react');
|
56
|
+
// } else {
|
57
|
+
// (config.resolve!.alias as Alias).react = path.resolve(
|
58
|
+
// __dirname,
|
59
|
+
// '../../../../../',
|
60
|
+
// 'node_modules',
|
61
|
+
// 'react',
|
62
|
+
// );
|
63
|
+
// }
|
64
|
+
// if (
|
65
|
+
// pkgJSON.dependencies['react-dom'] ||
|
66
|
+
// pkgJSON.devDependencies['react-dom']
|
67
|
+
// ) {
|
68
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
69
|
+
// 'node_modules/react-dom',
|
70
|
+
// );
|
71
|
+
// } else {
|
72
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
73
|
+
// __dirname,
|
74
|
+
// '../../../../../',
|
75
|
+
// 'node_modules',
|
76
|
+
// 'react-dom',
|
77
|
+
// );
|
78
|
+
// }
|
61
79
|
|
62
80
|
config.resolve.fallback = {
|
63
81
|
path: require.resolve('path-browserify')
|
package/dist/types/index.d.ts
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
declare const _default: import("@modern-js/core").AsyncPlugin<Partial<import("@modern-js/core").Progresses2Threads<{
|
2
2
|
config: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
3
|
+
resolvedConfig: import("@modern-js/core").AsyncWaterfall<{
|
4
|
+
resolved: import("@modern-js/core").NormalizedConfig;
|
5
|
+
}>;
|
3
6
|
validateSchema: import("@modern-js/core").ParallelWorkflow<void, unknown>;
|
4
7
|
prepare: import("@modern-js/core").AsyncWorkflow<void, void>;
|
5
8
|
commands: import("@modern-js/core").AsyncWorkflow<{
|
package/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.1.
|
14
|
+
"version": "1.1.3",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -25,15 +25,16 @@
|
|
25
25
|
},
|
26
26
|
"default": "./dist/js/treeshaking/index.js"
|
27
27
|
},
|
28
|
-
"./cli": "./dist/js/node/index.js"
|
28
|
+
"./cli": "./dist/js/node/index.js",
|
29
|
+
"./package.json": "./package.json"
|
29
30
|
},
|
30
31
|
"dependencies": {
|
31
32
|
"@babel/parser": "^7.15.2",
|
32
33
|
"@babel/runtime": "^7",
|
33
34
|
"@mdx-js/mdx": "^1.6.22",
|
34
35
|
"@mdx-js/react": "^1.6.22",
|
35
|
-
"@modern-js/utils": "^1.1.
|
36
|
-
"@modern-js/webpack": "^1.1.
|
36
|
+
"@modern-js/utils": "^1.1.5",
|
37
|
+
"@modern-js/webpack": "^1.1.2",
|
37
38
|
"antd": "^4.16.13",
|
38
39
|
"chokidar": "^3.5.2",
|
39
40
|
"core-js": "^3.17.2",
|
@@ -57,7 +58,7 @@
|
|
57
58
|
"webpack-dev-server": "^4.1.1"
|
58
59
|
},
|
59
60
|
"devDependencies": {
|
60
|
-
"@modern-js/module-tools-hooks": "^1.1.
|
61
|
+
"@modern-js/module-tools-hooks": "^1.1.1",
|
61
62
|
"@types/core-js": "^2.5.5",
|
62
63
|
"@types/github-slugger": "^1.3.0",
|
63
64
|
"@types/glob": "^7.1.4",
|
@@ -68,12 +69,12 @@
|
|
68
69
|
"@types/react-dom": "^17",
|
69
70
|
"@types/webpack-dev-server": "^4.1.0",
|
70
71
|
"typescript": "^4",
|
71
|
-
"@modern-js/core": "^1.
|
72
|
-
"@modern-js/plugin-testing": "^1.
|
73
|
-
"@modern-js/module-tools": "^1.
|
72
|
+
"@modern-js/core": "^1.2.0",
|
73
|
+
"@modern-js/plugin-testing": "^1.1.1",
|
74
|
+
"@modern-js/module-tools": "^1.1.2"
|
74
75
|
},
|
75
76
|
"peerDependencies": {
|
76
|
-
"@modern-js/core": "^1.
|
77
|
+
"@modern-js/core": "^1.2.0"
|
77
78
|
},
|
78
79
|
"sideEffects": false,
|
79
80
|
"modernConfig": {
|
@@ -95,5 +96,6 @@
|
|
95
96
|
"new": "modern new",
|
96
97
|
"build": "modern build",
|
97
98
|
"test": "modern test --passWithNoTests"
|
98
|
-
}
|
99
|
+
},
|
100
|
+
"readme": "\n<p align=\"center\">\n <a href=\"https://modernjs.dev\" target=\"blank\"><img src=\"https://lf3-static.bytednsdoc.com/obj/eden-cn/ylaelkeh7nuhfnuhf/modernjs-cover.png\" width=\"300\" alt=\"Modern.js Logo\" /></a>\n</p>\n<p align=\"center\">\n现代 Web 工程体系\n <br/>\n <a href=\"https://modernjs.dev\" target=\"blank\">\n modernjs.dev\n </a>\n</p>\n<p align=\"center\">\n The meta-framework suite designed from scratch for frontend-focused modern web development\n</p>\n\n# Introduction\n\n> The doc site ([modernjs.dev](https://modernjs.dev)) and articles are only available in Chinese for now, we are planning to add English versions soon.\n\n- [Modern.js: Hello, World!](https://zhuanlan.zhihu.com/p/426707646)\n\n## Getting Started\n\n- [Quick Start](https://modernjs.dev/docs/start)\n- [Guides](https://modernjs.dev/docs/guides)\n- [API References](https://modernjs.dev/docs/apis)\n\n## Contributing\n\n- [Contributing Guide](https://github.com/modern-js-dev/modern.js/blob/main/CONTRIBUTING.md)\n"
|
99
101
|
}
|
package/src/build-task.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { IAppContext } from '@modern-js/core';
|
1
|
+
import type { IAppContext, CoreOptions } from '@modern-js/core';
|
2
2
|
import { Import } from '@modern-js/utils';
|
3
3
|
|
4
4
|
const core: typeof import('@modern-js/core') = Import.lazy(
|
@@ -20,7 +20,11 @@ const taskMain = async ({ appContext }: IBuildTaskOption) => {
|
|
20
20
|
};
|
21
21
|
|
22
22
|
(async () => {
|
23
|
-
|
23
|
+
let options: CoreOptions | undefined;
|
24
|
+
if (process.env.CORE_INIT_OPTION_FILE) {
|
25
|
+
({ options } = require(process.env.CORE_INIT_OPTION_FILE));
|
26
|
+
}
|
27
|
+
const { appContext } = await core.cli.init([], options);
|
24
28
|
await core.manager.run(async () => {
|
25
29
|
try {
|
26
30
|
await taskMain({ appContext });
|
@@ -35,10 +35,20 @@ export function generatorWebpackConfig(
|
|
35
35
|
}),
|
36
36
|
],
|
37
37
|
};
|
38
|
+
const docsiteNodeModules = [
|
39
|
+
// for yarn
|
40
|
+
path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')),
|
41
|
+
// for pnpm
|
42
|
+
path.resolve(
|
43
|
+
path.dirname(require.resolve('@modern-js/plugin-docsite/package.json')),
|
44
|
+
'../..',
|
45
|
+
),
|
46
|
+
];
|
38
47
|
|
48
|
+
// maybe check if outside appDir or monorepoDir
|
39
49
|
config.resolve!.modules = [
|
40
50
|
...(config.resolve!.modules || []),
|
41
|
-
|
51
|
+
...docsiteNodeModules,
|
42
52
|
];
|
43
53
|
(config.resolve!.alias as Alias)['@assets'] = path.resolve(
|
44
54
|
appDirectory,
|
@@ -53,35 +63,35 @@ export function generatorWebpackConfig(
|
|
53
63
|
`${path.dirname(require.resolve('core-js'))}/fn`
|
54
64
|
] = 'core-js/es';
|
55
65
|
|
56
|
-
const pkgJSON = JSON.parse(
|
57
|
-
|
58
|
-
);
|
66
|
+
// const pkgJSON = JSON.parse(
|
67
|
+
// fs.readFileSync(path.join(appDirectory, 'package.json'), 'utf-8'),
|
68
|
+
// );
|
59
69
|
|
60
|
-
if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
61
|
-
|
62
|
-
} else {
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
}
|
70
|
-
if (
|
71
|
-
|
72
|
-
|
73
|
-
) {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
} else {
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
70
|
+
// if (pkgJSON.dependencies.react || pkgJSON.devDependencies.react) {
|
71
|
+
// (config.resolve!.alias as Alias).react = path.resolve('node_modules/react');
|
72
|
+
// } else {
|
73
|
+
// (config.resolve!.alias as Alias).react = path.resolve(
|
74
|
+
// __dirname,
|
75
|
+
// '../../../../../',
|
76
|
+
// 'node_modules',
|
77
|
+
// 'react',
|
78
|
+
// );
|
79
|
+
// }
|
80
|
+
// if (
|
81
|
+
// pkgJSON.dependencies['react-dom'] ||
|
82
|
+
// pkgJSON.devDependencies['react-dom']
|
83
|
+
// ) {
|
84
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
85
|
+
// 'node_modules/react-dom',
|
86
|
+
// );
|
87
|
+
// } else {
|
88
|
+
// (config.resolve!.alias as Alias)['react-dom'] = path.resolve(
|
89
|
+
// __dirname,
|
90
|
+
// '../../../../../',
|
91
|
+
// 'node_modules',
|
92
|
+
// 'react-dom',
|
93
|
+
// );
|
94
|
+
// }
|
85
95
|
|
86
96
|
config.resolve!.fallback = {
|
87
97
|
path: require.resolve('path-browserify'),
|