[英]How do I get webpack to compile the main.js file in app/js directory?
I am ripping my hair out here, I am trying to create a Reactjs app. 我在这里扯头发,我试图创建一个Reactjs应用程序。 I have created the folder then executed:
我创建了文件夹然后执行:
npm install webpack -g
Then I executed: 然后我执行了:
npm init
Completed the package.json file: 完成package.json文件:
{
"name": "reactquiz",
"version": "1.0.0",
"description": "This is a Reactjs quiz app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Daniel Cortes",
"license": "ISC",
"devDependencies": {
"babel-core": "6.13.*",
"babel-loader": "6.2.*",
"webpack": "^1.13.2"
},
"dependencies": {
"react": "^15.3.1",
"react-dom": "^15.3.1"
}
}
Then I executed webpack locally: 然后我在本地执行了webpack:
npm install webpack --save-dev
Then I created the webpack.config.js file: 然后,我创建了webpack.config.js文件:
module.export = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
filename: 'app/js/main.js'
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
}]
}
}
And I realized I still do not have a main.js file in app/js. 而且我意识到我在app / js中仍然没有main.js文件。 Please help.
请帮忙。 I have looked at the webpack documentation, I have looked here, I have looked at tutorials.
我看过webpack文档,我看过这里,看过教程。 What is the proper way to install webpack so it generates the file in app/js/main.js?
什么是安装webpack以便在app / js / main.js中生成文件的正确方法是什么?
The filename doesn't look right, the correct format is: 文件名看起来不正确,正确的格式为:
filename: './app/js/main.js'
Additionally, you didn't "execute webpack", you installed it. 另外,您没有“执行webpack”,而是安装了它。 Did you execute the command
webpack
after that too? 之后,您是否也执行了
webpack
命令?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.