问题描述
我对 webpack 不是很熟悉,一直遇到这个问题,这使得调试非常困难:当发生错误时,导致错误的行不会出现。相反,调试器只是输出 Failed to open eval code (301)
。
我正在使用 office-js
开发 Office 插件,并使用 webpack 构建生产环境,以及在本地运行开发服务器。
下面是我的webpack.dev.config
。这主要是我在网上找到的示例和建议的大杂烩,因此可能存在许多错误和改进空间:
const path = require('path')
const HtmlWebPackPlugin = require("html-webpack-plugin")
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
module.exports = {
mode: 'development',entry: ['react-hot-loader/patch','./src/js/index.js'],output: {
path: path.join(__dirname,'dist'),publicPath: '/',filename: '[name].js'
},target: 'web',devtool: 'eval',resolve: {
extensions: ['.html','.js']
},node: {
fs: 'empty',},optimization: {
minimize: false
},devServer: {
contentBase: path.join(__dirname,compress: true,port: 3000
},module: {
rules: [
{
test: /\.js$/,exclude: /node_modules/,loader: "babel-loader",{
// Loads the javacript into html template provided.
// Entry point is set below in HtmlWebPackPlugin in Plugins
test: /\.html$/,use: [
{
loader: "html-loader",//options: { minimize: true }
}
]
},{
test: /\.css$/,use: [ 'style-loader','css-loader' ]
},{
test: /\.(png|svg|jpg|gif)$/,use: ['file-loader']
}
]
},plugins: [
new CleanWebpackPlugin(),new HtmlWebPackPlugin({
template: "./src/html/index.html",filename: "./index.html",excludeChunks: [ 'server' ]
})
]
};
这是 Edge 调试器的屏幕截图(Office 插件在 Office 应用程序内的 Edge 实例上运行):
非常感谢任何帮助、建议和更正。提前致谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)