在 Global.js 模块中:
export let transLog = [];
Run Code Online (Sandbox Code Playgroud)
主要内容:
import * as G from "./Global";
G.transLog = [];
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
app.js?c99e:19 Uncaught TypeError: Cannot set property q of #<Object> which has only a getter
at eval (app.js?c99e:19)
at Object.<anonymous> (bootstrap e92860b74eb6dd40b159:62)
at __webpack_require__ (bootstrap e92860b74eb6dd40b159:19)
at bootstrap e92860b74eb6dd40b159:62
at bootstrap e92860b74eb6dd40b159:62
Run Code Online (Sandbox Code Playgroud)
网络包配置:
const webpack = require('webpack');
module.exports = {
entry: './js/app.js',
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: "[file].map"
})
],
output: {
filename: './dist/app.js'
},
devtool: 'source-map'
};
Run Code Online (Sandbox Code Playgroud)
那么,如何修改其他模块中的变量呢?