webpack-article
webpack-article copied to clipboard
ES2015 Import not recognized
ERROR in ./src/index.js Module parse failed: [...]\webpack-article-master\src\index.js Line 1: Unexpected token You may need an appropriate loader to handle this file type. | import './styles.scss'; | | // If we have an anchor, render the Button component on it
Is it just me or what but when I install it and try to run webpack
then it simply doesn't work. ;)
I know that it's not issue of this project but I wonder how did You managed to have it running properly?
Is this on master or at a specific commit?
Master. I found a fix for it. In webpack.config.js I changed it to this:
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: ['es2015']
}
}
and also npm installed babel-preset-es2015 and now I'm after first component from article and it passed that issue with import. Now I'm facing another issue but it's not topic for this place.
Ah no yes, that's because Babel 6 got out and so running npm install babel-loader
will get it, whereas the article was written with Babel 5. Will need to update the article.