Vuejs:无法解析模块'fs'

时间:2018-02-09 16:29:35

标签: javascript vue.js fs

我安装了资源包软件包:

npm install resource-bundle

但是建筑:

npm run build

收到错误:  '无法解析模块'fs''。我该怎么办?

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'
}

*在最后添加了fs:'empty'。

1 个答案:

答案 0 :(得分:2)

尝试将以下内容添加到Webpack配置中:

node: {
   fs: "empty"
}