[英]Vuejs: Cannot resolve module 'fs'
I installed resource-bundle package:我安装了资源包:
npm install resource-bundle
But for building:但对于建筑:
npm run build
gets error: 'cannot resolve module 'fs' '.得到错误:'无法解析模块'fs''。 what should i do?我该怎么办?
webpack.base.conf.js: webpack.base.conf.js:
'use strict'
const path = require('path')
const utils = require('./utils')
const config = require('../config')
const vueLoaderConfig = require('./vue-loader.conf')
function resolve (dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
entry: {
app: './src/main.js'
},
output: {
path: config.build.assetsRoot,
filename: '[name].js',
publicPath: process.env.NODE_ENV === 'production'
? config.build.assetsPublicPath
: config.dev.assetsPublicPath
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'vue$': 'vue/dist/vue.esm.js',
'@': resolve('src')
}
},
module: {
...
}
}
node: {
fs: 'empty'
}
*added fs: 'empty' at the end. *在末尾添加了 fs: 'empty'。
Try to add the following to your Webpack config:尝试将以下内容添加到您的 Webpack 配置中:
node: {
fs: "empty"
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.