Closed nitinsurana closed 6 years ago
Webpack version: 3.8.1
Webpack Karma version: 2.0.5
Karma version: 1.7.1
Please tell us about your environment: Windows 10
Browser: [Phantom XX | Chrome XX | Firefox XX | IE XX | Safari XX | Other XX] Chrome + Firefox + IE
Current behavior: Arrow functions are not transpiled.
Expected/desired behavior: Arrow functions should be transpiled using the babel-loader configuration in webpack.config.js
babel-loader
webpack.config.js
const path = require('path') const buildCore = true module.exports = // function (env) { // const buildCore = env && env.core || false // console.log("Building core : ", buildCore) // return { context: path.resolve('src'), entry: { app: buildCore ? './nn-core-main' : './nn-standard-main' }, output: { path: path.resolve('dist'), filename: buildCore ? 'nn-core.js' : 'nn-standard.js', publicPath: '/dist/' }, module: { loaders: [ { loader: "babel-loader", include: [ path.resolve(__dirname, "src"), ], exclude: [ path.resolve(__dirname, "node_modules"), ], query: { presets: ['es2015'] }, test: /\.jsx?$/ }, ] } } // }
Above works like a charm with both webpack and karma start --auto-watch commands. But if the commented lines are uncommented accordingly, then the transpiling fails, resulting in error in IE11.
webpack
karma start --auto-watch
karma.conf.js
var webpackConfig = require('./webpack.config'); webpackConfig.entry = function(){return {}}; module.exports = function (config) { config.set({ browsers: ['IE_no_addons', 'Chrome', 'Firefox'], customLaunchers: { IE_no_addons: { base: 'IE', flags: ['-extoff'] } }, files: [ 'src/util/zet.js', 'src/util/zet.test.js', 'src/util/serialization.js', 'src/util/serialization.test.js' ], plugins: [ 'karma-chrome-launcher', 'karma-firefox-launcher', 'karma-ie-launcher', 'karma-mocha', 'karma-chai', 'karma-webpack' ], frameworks: ['mocha', 'chai'], port: 9876, colors: false, logLevel: config.LOG_DEBUG, autoWatch: false, preprocessors: { 'src/util/zet.js': ['webpack'], 'src/util/zet.test.js': ['webpack'], 'src/util/serialization.js': ['webpack'], 'src/util/serialization.test.js': ['webpack'] }, webpack: webpackConfig, webpackMiddleware: { noInfo: false }, singleRun: false, concurrency: Infinity, }); };
Possible duplicate of #243
Fix is same as mentioned here
Webpack version: 3.8.1
Webpack Karma version: 2.0.5
Karma version: 1.7.1
Please tell us about your environment: Windows 10
Browser: [Phantom XX | Chrome XX | Firefox XX | IE XX | Safari XX | Other XX] Chrome + Firefox + IE
Current behavior: Arrow functions are not transpiled.
Expected/desired behavior: Arrow functions should be transpiled using the
babel-loader
configuration inwebpack.config.js
webpack.config.js
Above works like a charm with both
webpack
andkarma start --auto-watch
commands. But if the commented lines are uncommented accordingly, then the transpiling fails, resulting in error in IE11.karma.conf.js