Create a gist now

Instantly share code, notes, and snippets.

@ara-ta3 /Makefile
Last active Nov 29, 2017

What would you like to do?
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