Я использую webpack как систему сборки для файлов React.js. Я пользуюсь webpack --watch, чтобы создать пакет и дождаться изменений, а затем перестроить снова. Но у меня есть ситуация как он создает пакет и выйти, не ждать каких-либо changes.i вмятина знаю, что происходит не такwebpack --watch не работает должным образом
Мои webpack.config.js
module.exports = {
entry: [
'./Components/App.js'
],
output:{
path:__dirname,
filename:'bundle.js'
},
module:{
loaders:[{
test: /\.jsx?$/,
exclude:/node_modules/,
loader:'babel',
query:{
presets: ['react']
}
}]
}
};
package.json
{
"name": "Sample",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies":{
"react": "^0.14.6",
"react-dom": "^0.14.6",
"webpack": "^1.12.9",
"webpack-dev-server": "^1.14.0",
"babel-core": "^6.2.1",
"babel-loader": "^6.2.0",
"babel-preset-es2015": "^6.1.18",
"babel-preset-react": "^6.1.18"
}
}
App.js
import React from 'react';
import ReactDOM from 'react-dom';
var HelloWorld = React.createClass({
render:function(){
return (
<div>
<h1> This is a heading </h1>
<p> This is a Paragraph </p>
</div>
);
}
});
ReactDOM.render(<HelloWorld />,document.getElementById('container'));
Просьба поделиться с вами файлом webpack.config.js. – hazardous