@modern-js/plugin-docsite 1.1.1 → 1.1.2
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
CHANGED
@@ -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')
|
@@ -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/package.json
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
"modern",
|
12
12
|
"modern.js"
|
13
13
|
],
|
14
|
-
"version": "1.1.
|
14
|
+
"version": "1.1.2",
|
15
15
|
"jsnext:source": "./src/index.ts",
|
16
16
|
"types": "./dist/types/index.d.ts",
|
17
17
|
"main": "./dist/js/node/index.js",
|
@@ -25,7 +25,8 @@
|
|
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",
|
@@ -69,8 +70,8 @@
|
|
69
70
|
"@types/webpack-dev-server": "^4.1.0",
|
70
71
|
"typescript": "^4",
|
71
72
|
"@modern-js/core": "^1.1.2",
|
72
|
-
"@modern-js/plugin-testing": "^1.1.
|
73
|
-
"@modern-js/module-tools": "^1.1.
|
73
|
+
"@modern-js/plugin-testing": "^1.1.1",
|
74
|
+
"@modern-js/module-tools": "^1.1.1"
|
74
75
|
},
|
75
76
|
"peerDependencies": {
|
76
77
|
"@modern-js/core": "^1.1.2"
|
@@ -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'),
|