-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support webpack5 && add example
- Loading branch information
kurthe
committed
Mar 6, 2021
1 parent
2ceaa7c
commit 5836fa9
Showing
10 changed files
with
9,060 additions
and
5,796 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
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
const a = new Map([[1, 2]]); | ||
|
||
const b = new Set([[3, 6]]); | ||
|
||
console.warn(a,b) |
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "plugin-webpack4-demo", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"build:runtime": "webpack --config webpack.config.runtime.js", | ||
"build:usage": "webpack --config webpack.config.usage.js" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"core-js": "^3.6.5", | ||
"html-webpack-plugin": "^5.2.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.12.3", | ||
"@babel/preset-env": "^7.12.1", | ||
"babel-loader": "^8.1.0", | ||
"html-webpack-polyfill-runtime-plugin": "latest", | ||
"webpack": "^5.24.3", | ||
"webpack-cli": "^4.5.0" | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## 使用 | ||
|
||
1. install root node_modules | ||
2. install example project node_modules | ||
3. run `npm run build:runtime` or `npm run build:usage` |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
const HtmlPolyfillRuntimePlugin = require('html-webpack-polyfill-runtime-plugin'); | ||
|
||
module.exports = { | ||
entry: "./app.js", | ||
mode: "production", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: [['@babel/preset-env', { | ||
targets: [ | ||
'defaults', | ||
'Chrome > 33', | ||
'ios_saf > 7', | ||
'android > 4.4', | ||
], | ||
}]] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [new HtmlWebpackPlugin(), new HtmlPolyfillRuntimePlugin()], | ||
} |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
entry: "./app.js", | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.js$/, | ||
exclude: /(node_modules|bower_components)/, | ||
use: { | ||
loader: 'babel-loader', | ||
options: { | ||
presets: [['@babel/preset-env', { | ||
useBuiltIns: 'usage', | ||
corejs: 3, | ||
targets: [ | ||
'defaults', | ||
'Chrome > 33', | ||
'ios_saf > 7', | ||
'android > 4.4', | ||
], | ||
}]] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
plugins: [new HtmlWebpackPlugin()], | ||
} |
Oops, something went wrong.