_uWebpack_u导出是不正确的

vof42yt1  于 2021-09-23  发布在  Java
关注(0)|答案(0)|浏览(195)

webpack.config.js是

return {
    entry: './src/main.js',
    mode: 'development',
    output: {
      path: path.resolve(__dirname, 'dist'),
      filename: '[name].js',
      library: {
        name: 'BusinessApp1',
        type: 'umd'
      }
    },
    devServer: {
      liveReload: false,
      index: 'index.html',
      contentBase: path.resolve(__dirname, 'dist'),
      compress: true,
      port: 3003,
      // hot: true,
      // inline: true,
      headers: {
        "Access-Control-Allow-Origin": "*",
      },
    },
    module: {
      rules: [
        // ...some rules
      ],
    },
    plugins: [
      new VueLoaderPlugin()
    ]
  }

bundle main.js看起来像:

(function webpackUniversalModuleDefinition(root, factory) {
    if(typeof exports === 'object' && typeof module === 'object')
        module.exports = factory();
    else if(typeof define === 'function' && define.amd)
        define([], factory);
    else if(typeof exports === 'object')
        exports["BusinessApp1"] = factory();
    else
        root["BusinessApp1"] = factory();
})(self, function() {
/************************************************************************/
/******/    
/******/    // startup
/******/    // Load entry module and return exports
/******/    // This entry module can't be inlined because the eval devtool is used.
/******/    __webpack_require__("./src/main.js");
/******/    var __webpack_exports__ = __webpack_require__("./node_modules/webpack-dev-server/client/index.js?http://localhost:3003");
/******/    
/******/    return __webpack_exports__;
/******/ })()

它导出的是网页包dev server/client/index.js,而不是我的应用程序条目文件('./src/main.js')。这让我很困惑。
如何正确导出应用程序条目文件?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题