Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 整合';字符串替换加载程序';进入Vue CLI_Vue.js_Webpack_Vue Cli - Fatal编程技术网

Vue.js 整合';字符串替换加载程序';进入Vue CLI

Vue.js 整合';字符串替换加载程序';进入Vue CLI,vue.js,webpack,vue-cli,Vue.js,Webpack,Vue Cli,正如标题所说,我想在vue.config.js文件中集成“string replace loader”,但我一生都无法启动它,到目前为止,我已经尝试了以下方法: module.exports = { chainWebpack: config => { config.module .rule('stringReplace') .use('vue-loader') .loader('string-replace-loader')

正如标题所说,我想在vue.config.js文件中集成“string replace loader”,但我一生都无法启动它,到目前为止,我已经尝试了以下方法:

module.exports = {
  chainWebpack: config => {
    config.module
      .rule('stringReplace')
      .use('vue-loader')
        .loader('string-replace-loader')
        .tap(options => {
          const newOptions = {
            search: 'bundles',
            replace: target,
            flags: 'g',
        }
          return { ...options, ...newOptions };
        })
  }
};
无济于事,而且:

module.exports = {
  chainWebpack: config => {
    config.module.rules.delete('vue');
    config.module
      .rule('vue')
      .test(/\.(vue)(\?.*)?$/)
      .use('vue-loader')
        .loader('vue-loader')
      .use('string-replace-loader')
        .loader('string-replace-loader')
        .tap(options => {
          const newOptions = {
            search: 'bundles',
            replace: target,
            flags: 'g',
        }
          return { ...options, ...newOptions };
        })
  }
};
没有任何运气

任何帮助都将不胜感激

谢谢