Skip to content

Commit f18ed7e

Browse files
committed
add babel engine plugin to webpack for IE compatibility
1 parent d5c4fcb commit f18ed7e

File tree

5 files changed

+179
-19
lines changed

5 files changed

+179
-19
lines changed

package-lock.json

Lines changed: 169 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,14 @@
5454
"autoprefixer": "^7.0.1",
5555
"babel": "^6.5.2",
5656
"babel-core": "^6.24.0",
57+
"babel-engine-plugin": "^0.2.1",
5758
"babel-eslint": "^8.2.1",
5859
"babel-jest": "^22.2.0",
5960
"babel-loader": "^7.0.0",
6061
"babel-plugin-transform-decorators-legacy": "^1.3.4",
6162
"babel-plugin-transform-object-assign": "^6.22.0",
6263
"babel-plugin-transform-react-jsx": "^6.8.0",
64+
"babel-preset-env": "^1.7.0",
6365
"babel-preset-es2015": "^6.24.0",
6466
"babel-preset-stage-0": "^6.5.0",
6567
"babel-register": "^6.24.0",

src/complete.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import 'core-js/fn/array/fill';
33
import 'core-js/fn/array/map';
44
import 'core-js/fn/array/for-each';
55
import 'core-js/fn/array/filter';
6+
import 'core-js/fn/array/from';
7+
68
import { init } from './lib/init';
79
import { CMP_GLOBAL_NAME } from "./lib/cmp";
810

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'core-js/fn/array/for-each';
55
import 'core-js/fn/array/filter';
66
import 'core-js/fn/array/from';
77

8-
import {init} from './lib/init';
8+
import { init } from './lib/init';
99
import { CMP_GLOBAL_NAME } from './lib/cmp';
1010

1111
function start() {

webpack.config.babel.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import HtmlWebpackPlugin from 'html-webpack-plugin';
33
import CopyWebpackPlugin from 'copy-webpack-plugin';
44
import autoprefixer from 'autoprefixer';
55
import path from 'path';
6+
const BabelEnginePlugin = require('babel-engine-plugin');
67

78
const ENV = process.env.NODE_ENV || 'development';
89

@@ -195,7 +196,10 @@ module.exports = [
195196
// Static assets copy
196197
new CopyWebpackPlugin([
197198
{ from: './geoip.json' }
198-
])
199+
]),
200+
new BabelEnginePlugin({
201+
presets: ['env']
202+
})
199203
]).concat(ENV === 'production' ? uglifyPlugin : []),
200204
},
201205
// Docs config

0 commit comments

Comments
 (0)