webpack.config.js
var webpack = require("webpack");
module.exports = {
entry: "./src/index.js",
output: {
path: "dist/assets",
filename: "bundle.js",
publicPath: "assets"
},
devServer: {
inline: true,
contentBase: "./dist",
port: 3000
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules)/,
loader: "babel-loader",
query: {
presets: ["latest", "stage-0", "react"]
}
}
]
}
}
package.json
{
"name": "react-essential",
"version": "1.0.0",
"description": "A project focusing on React and related tools",
"main": "index.js",
"scripts": {
"start": "httpster -d ./dist -p 3000"
},
"author": "Indu Pillai",
"license": "MIT",
"devDependencies": {
"babel-cli": "^6.18.0",
"babel-loader": "^6.4.1",
"babel-preset-latest": "^6.16.0",
"babel-preset-react": "^6.16.0",
"babel-preset-stage-0": "^6.16.0",
"webpack": "^2.3.2",
"webpack-dev-server": "^2.4.2"
}
}
我一遍又一遍地重复了这些步骤,但它仍然不起作用。我对webpack还很陌生,所以我无法找出问题所在,也不知道需要哪种绝对路径。我还尝试了另一个(类似)问题的答案建议的绝对路径,但那也没有起作用。
谢谢!