Babel Configuration

Babel-plugin-transform-imports

Cài đặt:
1
$ npm install --save-dev babel-plugin-transform-imports
Copied!
Cấu hình babel.config.js:
babel.config.js
1
["transform-imports", {
2
"lodash": {
3
"transform": "lodash/${member}",
4
"preventFullImport": true
5
}
6
}]
Copied!

Babel-plugin-import

Cài đặt:
1
$ npm install babel-plugin-import --save-dev
Copied!
Cấu hình babel.config.js:
babel.config.js
1
plugins: [
2
[
3
"import",
4
{ libraryName: "antd", libraryDirectory: "es", style: "css" }
5
],
6
]
Copied!

Reduce the Size Of Moment.js

Cài đặt:
1
$ npm install babel-plugin-import --save-dev
Copied!
Cấu hình wepback.base.babel.js:
wepback.base.babel.js
1
plugins: [
2
// load `moment/locale/en-gb.js` and `moment/locale/vi.js`
3
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en-gb|vi/),
4
]
Copied!
Last modified 11mo ago