3
我有一個Electron/Webpack項目,我試圖在文件更改上添加自動刷新。根據documentation,我採取了以下步驟:使用Electron中的Webpack自動刷新
- 我將
webpack-dev-server
添加到我的項目。 添加以下到我的
webpack.config.js
:devServer: { inline: true }
我用命令
webpack-dev-server --progress --colors
當我修改我的入境文件,它們沒有反映在的WebPack運行發出的代碼在http://localhost:8080/build/index.js
(我已經設置了我的輸出)。我錯過了什麼?
爲了完整起見,這裏是我的WebPack配置:
module.exports = {
entry: './src/index.tsx',
output: {
filename: './build/index.js'
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.ts', '.js', '.tsx', '.jsx']
},
module: {
loaders: [
{ test: /\.tsx?$/, loader: 'awesome-typescript-loader' }
]
},
devServer: {
inline: true
}
}
感謝您的分享。它幫助我理解如何構建我的'webpack'配置並正確設置目標:'web'與'electron'。 –