babel-loader doesn't working, es6 code stay un-compiled
See original GitHub issuethis 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:
- Created 6 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@soykje
test
should be a RegEx, but you’ve put quotes around it so it will not match any files. You wanttest: /\.js$/,
without the quotes.I had the same issue when I updated my build chain… weirdly placing a
.babelrc
in my folder fixed it…But it seems weird to need that…