-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(webpack): avoid duplicate import core package (#3871)
- Loading branch information
1 parent
062817f
commit d594eb0
Showing
3 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,32 @@ | ||
import path from 'node:path'; | ||
import { pureEsmPackage } from '@rsbuild/config/rslib.config.ts'; | ||
import { | ||
cjsConfig, | ||
dualPackage, | ||
esmConfig, | ||
} from '@rsbuild/config/rslib.config.ts'; | ||
import { defineConfig } from '@rslib/core'; | ||
|
||
export default defineConfig({ | ||
...pureEsmPackage, | ||
output: { | ||
...pureEsmPackage.output, | ||
copy: [ | ||
{ | ||
from: path.resolve(__dirname, 'src/index.cjs'), | ||
...dualPackage, | ||
lib: [ | ||
esmConfig, | ||
{ | ||
...cjsConfig, | ||
output: { | ||
target: 'node', | ||
// TODO https://github.com/web-infra-dev/rslib/issues/287 | ||
externals: { | ||
webpack: 'import webpack', | ||
'copy-webpack-plugin': 'import copy-webpack-plugin', | ||
'mini-css-extract-plugin': 'import mini-css-extract-plugin', | ||
'tsconfig-paths-webpack-plugin': | ||
'import tsconfig-paths-webpack-plugin', | ||
}, | ||
}, | ||
], | ||
}, | ||
footer: { | ||
// TODO https://github.com/web-infra-dev/rslib/issues/351 | ||
js: `// Annotate the CommonJS export names for ESM import in node: | ||
0 && (module.exports = { webpackProvider: exports.webpackProvider });`, | ||
}, | ||
}, | ||
], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d594eb0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Ran ecosystem CI: Open