admin管理员组文章数量:1429360
I'm trying to use webpack but i get an error
$ node_modules/.bin/webpack
Hash: d1aee5dc037997fae5a6
Version: webpack 3.4.1
Time: 31ms
ERROR in Entry module not found: Error: Can't resolve './assets/app.js' in 'D:\template\src'
It's my first time using webpack.
here is my script
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, './src'),
entry: {
app: './assets/app.js',
},
output: {
path: path.resolve(__dirname, './node_modules'),
filename: '[name].bundle.js',
},
};
My folder structure
I think i get the error here
context: path.resolve(__dirname, './src'),
I just don't know with what i replace that part.
I already read this and already try searching with google about how to use webpack. Any solutions ?.
"devDependencies": {
"buefy": "",
"bulma": "",
"vue": "^2.1.10",
"webpack": "^3.4.1"
},
I'm trying to use webpack but i get an error
$ node_modules/.bin/webpack
Hash: d1aee5dc037997fae5a6
Version: webpack 3.4.1
Time: 31ms
ERROR in Entry module not found: Error: Can't resolve './assets/app.js' in 'D:\template\src'
It's my first time using webpack.
here is my script
const path = require('path');
const webpack = require('webpack');
module.exports = {
context: path.resolve(__dirname, './src'),
entry: {
app: './assets/app.js',
},
output: {
path: path.resolve(__dirname, './node_modules'),
filename: '[name].bundle.js',
},
};
My folder structure
I think i get the error here
context: path.resolve(__dirname, './src'),
I just don't know with what i replace that part.
I already read this https://webpack.github.io/docs/tutorials/getting-started
and already try searching with google about how to use webpack. Any solutions ?.
"devDependencies": {
"buefy": "",
"bulma": "",
"vue": "^2.1.10",
"webpack": "^3.4.1"
},
Share
Improve this question
edited Jul 28, 2017 at 15:29
Michael Jungo
33.1k4 gold badges95 silver badges87 bronze badges
asked Jul 28, 2017 at 15:11
YVS1102YVS1102
2,7407 gold badges37 silver badges65 bronze badges
1 Answer
Reset to default 3The context
option defines the base directory that is used to resolve anything in the webpack config. You are using ./src/
as the base directory, so ./assets/app.js
is resolved inside the src
directory (it would technically be ./src/assets/app.js
).
If no context
is provided, webpack will use the current directory, which is what you want. You can remove context
entirely from your config. You probably also want to output the bundle into a directory such as ./dist
instead of into ./node_modules
. Your config would be as follows.
const path = require('path');
const webpack = require('webpack');
module.exports = {
entry: {
app: './assets/app.js',
},
output: {
path: path.resolve(__dirname, './dist'),
filename: '[name].bundle.js',
},
};
You were looking at the webpack 1 docs, but you should use the newer docs, which are significantly better: Webpack - Getting Started.
本文标签: javascriptEntry module not found Can39t resolve 39assetsappjs39Stack Overflow
版权声明:本文标题:javascript - Entry module not found: Can't resolve '.assetsapp.js' - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745439790a2658393.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论