Recent versions of webpack do not support IE8. I tried from 12/12/12 (which I thought was the latest version to support IE8), but still getting errors from the non-shimmable Object.defineProperty .
https://github.com/webpack/webpack/issues/2085
What was the latest version of webpack to support IE8? Has it ever worked with ES6 modules?
webpack.config.js:
var webpack = require("webpack"); var es3ifyPlugin = require('es3ify-webpack-plugin'); var productionPlugin = new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }); var devPlugin = new webpack.DefinePlugin({ "process.env": { NODE_ENV: JSON.stringify("dev") } }); module.exports = { entry: { assessment: "./src/aaa/app.js" }, //devtool: "source-map", output: { path: "../AAA/wwwroot/js", filename: "[name].bundle.js", publicPath: "/" }, resolve: { extensions: ["", ".js"] }, module: { preLoaders: [ { test: /\.js$/, loader: "eslint-loader", exclude: "node_modules" } ], loaders: [ { test: /\.js$/, exclude: /node_modules/, loader: "babel-loader" }, { // todo: move less compiling to web project test: /\.less$/, loader: "style-loader!css-loader!less-loader", exclude: "node_modules" }, ] }, devServer: { historyApiFallback: true, inline: true, proxy: { "/api": { "target": { host: "localhost", protocol: "http:", port: "58211", }, changeOrigin: true, pathRewrite: { "^/api": "" } } }, publicPath: "/assets/" }, plugins: [ new es3ifyPlugin(), new webpack.optimize.CommonsChunkPlugin({ name: "vendor", minChunks: isExternal }), productionPlugin //devPlugin ] } function isExternal(module) { var userRequest = module.userRequest; if (typeof userRequest !== "string") { return false; } return userRequest.indexOf("node_modules") >= 0; }
The transparent code looks like this:
exports.test = '123'; webpackJsonp([1, 0], [ function (module, exports, __webpack_require__) { 'use strict'; var _imported = __webpack_require__(1); alert('test ' + _imported.test); function(module, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var test = exports.test = 123; } ]);