Skip to content

Instantly share code, notes, and snippets.

@ara-ta3
Last active November 29, 2017 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ara-ta3/dd980bb3e014659339bf3739ff939e05 to your computer and use it in GitHub Desktop.
Save ara-ta3/dd980bb3e014659339bf3739ff939e05 to your computer and use it in GitHub Desktop.
Error on webpack with babel
/Users/a-tanaka/.nodebrew/current/bin/npm run webpack -- --config ./webpack.config.js
> webpack-hello@1.0.0 webpack /Users/a-tanaka/booster
> webpack --watch "--config" "./webpack.config.js"
Webpack is watching the files…
Hash: 4f6ee5333597035827a3
Version: webpack 3.8.1
Time: 48ms
ERROR in Entry module not found: Error: Can't resolve 'babel' in '/Users/a-tanaka/booster'
BREAKING CHANGE: It's no longer allowed to omit the '-loader' suffix when using loaders.
You need to specify 'babel-loader' instead of 'babel',
see https://webpack.js.org/guides/migrating/#automatic-loader-module-name-extension-removed
class Hoge {}
console.log(new Hoge());
NPM=$(shell which npm)
install: $(NPM)
$(NPM) install
webpack: $(NPM)
$(NPM) run webpack -- --config ./webpack.config.js
webpack/correct: $(NPM)
$(NPM) run webpack -- --config ./webpack.config.corrent.js
{
"name": "webpack-hello",
"version": "1.0.0",
"description": "hello world with webpack",
"main": "index.js",
"scripts": {
"webpack": "webpack --watch"
},
"author": "",
"license": "MIT",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-es2015": "^6.24.1",
"webpack": "3.8.1"
}
}
module.exports = {
entry: {
main :__dirname + "/main.js",
},
output: {
path: __dirname + '/dist/',
filename: '[name].bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
},
resolve: {
extensions: ['*', '.js']
}
};
module.exports = {
entry: {
main :__dirname + "/main.js",
},
output: {
path: __dirname + '/dist/',
filename: '[name].bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}
]
},
resolve: {
extensions: ['*', '.js']
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment