electron-Vue: Module parse failed: Unexpected character ‘ ‘
const path = require("path");
module.exports = {
// 其它配置
// 2024/06/05 更新: 区分以下开发环境与发布环境
chainWebpack: (config) => {
if (process.env.NODE_ENV !== 'production') {
config.module
.rule('native')
.test(/\.node$/)
.use('native-ext-loader')
.loader('native-ext-loader')
.options({
rewritePath: path.resolve(__dirname, "src/utils/napi/build/Release/")
});
} else {
config.module
.rule('native')
.test(/\.node$/)
.use('native-ext-loader')
.loader('native-ext-loader')
.options({
basePath: ["app.asar", ".."] // 最后xx.node被electron.builder打包到app.asar中了
});
}
},
};