question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

babel-loader doesn't working, es6 code stay un-compiled

See original GitHub issue

this is my config file

{
    entry: path.resolve(__dirname, '../app/index'),
    output: {
        path: path.resolve(__dirname, '../static/js'),
        publicPath: '/js/',
        filename: 'bundle.js'
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                exclude: /node_modules/,
                use: {
                    loader: 'babel-loader',
                    options: {
                        presets: [
                            'es2015',
                        ]
                    }
                },
            }
        ]
    }
}

this is part of the result

/***/ function(module, exports) {

	import Vue from 'vue';
	import App from './app.vue';

	new Vue({
	    el: '#app',
	    render: h => h(App)
	});


/***/ }

And webpack reports no error.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
loganfsmythcommented, May 12, 2017

@soykje test should be a RegEx, but you’ve put quotes around it so it will not match any files. You want test: /\.js$/, without the quotes.

3reactions
toabicommented, May 5, 2017

I had the same issue when I updated my build chain… weirdly placing a .babelrc in my folder fixed it…

{
  "presets": [["es2015"]]
}

But it seems weird to need that…

Read more comments on GitHub >

github_iconTop Results From Across the Web

babel loader not recognizing ES6 code in React app
babel etc needs to be devDependencies in your package.json. Try adding babel-polyfill to your dev dependencies.
Read more >
Babel · The compiler for next generation JavaScript - Babel.js
The compiler for next generation JavaScript.
Read more >
Why and how to transpile dependencies of your JavaScript ...
Web developers use bundlers (Webpack or Rollup) that transpile their applications' code. We'll figure out how to transpile the dependencies ...
Read more >
Setting Up a Babel Project - ECMAScript 6 Tutorial
Open a command prompt, and navigate ( cd ) to the es6-tutorial directory. ... This is because the current code in main.js doesn't...
Read more >
TypeScript With Babel: A Beautiful Marriage - I Am Turns
No problem, Babel converts the code and makes everything a-okay. Use the latest and greatest features without worry. The TypeScript compiler has ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found