webpack引入第三方js去除严格模式的几种方法

1. babel5

babel: {
    options: {
        blacklist: ["useStrict"],
        // ...
    },
    // ...
}

2. babel6

略过模块:
        {
  presets: [
    ["es2015", { "modules": false }]
  ]
}

略过某个文件:

{
  "presets": ["es2015"],
  "ignore": [
    "./src/js/directive/datePicker.js"
  ]
}

3. babel-plugin-transform-remove-strict-mode该插件通过npm安装在.babelrc中配置

plugins:["transform-remove-strict-mode"]

 

你可能感兴趣的:(webpack)