P
P
Pavel Novikov2018-02-12 17:14:12
JavaScript
Pavel Novikov, 2018-02-12 17:14:12

Why doesn't webpack-dev-server run babel-loader?

I'm trying to set up Webpack-dev-server and ran into one problem - it doesn't run babel-loader.
Below are all my dependencies

"devDependencies": {
    "babel-core": "^6.26.0",
    "babel-loader": "^7.1.2",
    "babel-preset-env": "^1.6.1",
    "babel-register": "^6.26.0",
    "jshint": "^2.9.5",
    "jshint-loader": "^0.8.4",
    "node-libs-browser": "^2.1.0",
    "webpack": "^3.11.0",
    "webpack-dev-server": "^2.11.1"
  },

Webpack config - webpack.config.js
module.exports = {
    entry: './src/app.js',
    output: {
        filename: 'app.js',
        path: path.resolve(__dirname, 'dist')
    },
    module: {
        loaders: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                loader: 'jshint-loader'

            },
            {
                test: /\.js$/,
                loader: "babel-loader",
                exclude: /node_modules/,
                query: {
                    presets: 
                }
            }
        ]
    },
    stats: {
        colors: true
    },
    devtool: 'source-map'
};

At the same time, Webpack-dev-server starts jshint-loader without problems. Why doesn't the babel loader start then?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
string15, 2018-02-12
@string15

{
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: ['env']
                    }
                }
            },

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question