0

我有一个角度应用程序。

在浏览器中,我看到源根为
webpack://src...

我想使用其他命名空间,例如
webpack://web-component-a/...
webpack://web-component-b/...

在我读过的 webpack 文档中,我可以这样做:
https ://webpack.js.org/configuration/output/#outputdevtoolnamespace

但是在 Angular 9 中,我没有 webpack 配置。如何合并自定义 webpack 部分文件并自定义“输出”对象而不重新定义它

4

1 回答 1

0

我想通了:

ng add ngx-build-plus

webpack.partial.js

const webpack = require('webpack');

module.exports = {
    output: {
        devtoolNamespace: 'client-a'
    },
    devtool: 'eval' // hint: namespace works not standalone
}

使用部分 webpack 配置运行:

ng serve --extra-webpack-config webpack.partial.js --port 7201 --single-bundle

预期结果:

在此处输入图像描述

于 2020-05-09T18:15:56.713 回答