Skip to content

Commit 95c415a

Browse files
committed
Add aliases to <repo>/src in standalone mode
1 parent f216d6a commit 95c415a

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

config/webpack.config.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -375,13 +375,18 @@ module.exports = (env, argv) => {
375375
...(!isSingleRepoMode
376376
? workspaceRepos.map((repo) => ({
377377
// Rewrite all '<repo>/dist' imports to '<repo>/src'
378-
[`${repo}/dist`]: path.join(workspacePath, isSingleRepoMode ? './' : repo, 'src'),
379-
[`${repo}/src`]: path.join(workspacePath, isSingleRepoMode ? './' : repo, 'src'),
380-
// Rewrite all '<repo>' imports to '<repo>/src'
381-
// instead of the '<repo>/dist' default defined in the package.json
382-
[`${repo}`]: path.join(workspacePath, isSingleRepoMode ? './' : repo, 'src'),
378+
[`${repo}/dist`]: path.join(workspacePath, repo, 'src'),
379+
[`${repo}/src`]: path.join(workspacePath, repo, 'src'),
380+
[`${repo}`]: path.join(workspacePath, repo, 'src'),
383381
}))
384-
: []),
382+
: [
383+
{
384+
// In single repo mode, also rewrite all '<repo>/dist' imports to '<repo>/src'
385+
[`${libName}/dist`]: path.join(workspacePath, 'src'),
386+
[`${libName}/src`]: path.join(workspacePath, 'src'),
387+
[`${libName}`]: path.join(workspacePath, 'src'),
388+
},
389+
]),
385390
),
386391
fallback: {
387392
util: require.resolve('util/'),
@@ -681,7 +686,12 @@ module.exports = (env, argv) => {
681686
[`${r}/dist`]: [path.join(workspacePath, r, 'src/*')],
682687
[r]: [path.join(workspacePath, r, 'src/index.ts')],
683688
}))
684-
: []),
689+
: [
690+
{
691+
[`${libName}/dist`]: path.join(workspacePath, 'src/*'),
692+
[libName]: path.join(workspacePath, 'src/index.ts'),
693+
},
694+
]),
685695
),
686696
},
687697
},

0 commit comments

Comments
 (0)