-
Notifications
You must be signed in to change notification settings - Fork 61
chore(build): switch to Webpack for ESM build #250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: v5
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,7 +60,7 @@ | |||||||||||
| "dev": "webpack --config webpack.dev.config.js --mode development", | ||||||||||||
| "build": "npm run clean && run-p build:*", | ||||||||||||
| "ci": "npm run build && npm run test", | ||||||||||||
| "build:esm": "tsc", | ||||||||||||
| "build:esm": "webpack --config webpack.esm.config.js --mode production", | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你好,将 这将导致 为了解决这个问题,你需要一个额外的步骤来生成声明文件。一个常见的做法是修改
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在更新
Suggested change
|
||||||||||||
| "build:umd": "webpack --config webpack.config.js --mode production", | ||||||||||||
| "publish:alpha": "npm publish --tag alpha", | ||||||||||||
| "test": "jest", | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,6 +15,7 @@ | |
| "resolveJsonModule": true, | ||
| "esModuleInterop": true, | ||
| "lib": ["esnext", "dom"], | ||
| "types": [], | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你好,这里的 另外,还有一个与新 Webpack 构建相关的重要问题:为了让 Webpack 正确处理 关于如何修改 |
||
| "experimentalDecorators": false /* Enables experimental support for ES7 decorators. */, | ||
| // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ | ||
| "downlevelIteration": true, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| const path = require("path"); | ||
|
|
||
| module.exports = { | ||
| entry: "./src/bundle-entry.ts", | ||
| experiments: { | ||
| outputModule: true, | ||
| }, | ||
| output: { | ||
| filename: "index.js", | ||
| publicPath: "", | ||
| path: path.resolve(__dirname, "lib"), | ||
| library: { | ||
| type: "module", | ||
| }, | ||
| clean: true, | ||
| }, | ||
| resolve: { | ||
| extensions: [".ts", ".js"], | ||
| }, | ||
| module: { | ||
| rules: [ | ||
| { | ||
| test: /\.tsx?$/, | ||
| use: "ts-loader", | ||
Aarebecca marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| exclude: /node_modules/, | ||
| }, | ||
| ], | ||
| }, | ||
| devtool: "source-map", | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.