xgqfrms™, xgqfrms® : xgqfrms's offical website of cnblogs! xgqfrms™, xgqfrms® : xgqfrms's offical website of GitHub!

webpack Public Path All In One

webpack Public Path All In One

if (window.__POWERED_BY_XGQFRMS__) {
  __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_XGQFRMS__;
}

public-path

https://webpack.js.org/guides/public-path/

https://webpack.js.org/configuration/output/#outputpublicpath

import webpack from 'webpack';

// Try the environment variable, otherwise use root
const ASSET_PATH = process.env.ASSET_PATH || '/';

export default {
  output: {
    publicPath: ASSET_PATH,
  },

  plugins: [
    // This makes it possible for us to safely use env vars on our code
    new webpack.DefinePlugin({
      'process.env.ASSET_PATH': JSON.stringify(ASSET_PATH),
    }),
  ],
};


__webpack_public_path__ = process.env.ASSET_PATH;


refs

https://qiankun.umijs.org/zh/guide/tutorial#微应用



©xgqfrms 2012-2020

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!


posted @ 2021-07-25 23:42  xgqfrms  阅读(93)  评论(0编辑  收藏  举报