账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    遇到webpackJsonp is not defined,配置应该怎么改?
    34
    0

    将vue-cli的配置稍微改了一下,让其能支持多页面,现在就只做了两个页面,一个login和一个app,开发时没问题,但打包时候报错:“webpackJsonp is not defined”,似乎是公共文件没有被加载到页面中,页面相关的配置如下。

    new HtmlWebpackPlugin({
          filename: config.build.app,
          template: 'index.html',
          inject: true,
          minify: {
            removeComments: true,
            collapseWhitespace: true,
            removeAttributeQuotes: true
          },
          chunksSortMode: 'dependency',
          chunks: ['app']
        }),
    new HtmlWebpackPlugin({
        filename: config.build.login,
        template: 'login.html',
        inject: true,
        minify: {
          removeComments: true,
          collapseWhitespace: true,
          removeAttributeQuotes: true
        },
        chunksSortMode: 'dependency',
        chunks: ['login']
      }),

    此外,公共文件的问题如下,我没有改过,只是去掉了一些原本的注释信息

    new webpack.optimize.CommonsChunkPlugin({
          name: 'vendor',
          minChunks: function (module, count) {
            return (
              module.resource &&
              /\.js$/.test(module.resource) &&
              module.resource.indexOf(
                path.join(__dirname, '../node_modules')
              ) === 0
            )
          }
        }),
    new webpack.optimize.CommonsChunkPlugin({
      name: 'manifest',
      chunks: ['vendor']
    }),

    应该怎么做修改才能正确打包?谢谢~

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 湘邵顽童 普通会员 1楼
      502 Bad Gateway

      502 Bad Gateway


      nginx
    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部