使用@angular-builders/custom-webpack升级到angular 15,获取样式加载器错误

mf98qq94  于 2023-05-07  发布在  Webpack
关注(0)|答案(1)|浏览(236)

演示存储库链接:https://github.com/OrShalmayev/style-loader-error
我最近将我的Angular项目从版本12升级到了15,我在我的angular.json文件中使用了以下配置:

"architect": {
    "build": {
        "builder": "@angular-builders/custom-webpack:browser",
        "options": {
            "customWebpackConfig": {
                "path": "config/library.webpack-config.js",
                "libraryName": "overview",
                "libraryTarget": "system"
            }
        }
    }
}

config/library.webpack-config.js文件:

/* eslint-disable no-undef,filenames/match-regex */
const singleSpaAngularWebpack = require('single-spa-angular/lib/webpack').default;
const {WebpackManifestPlugin} = require('webpack-manifest-plugin');
/* eslint-enable no-undef,filenames/match-regex */

const CLIENT_CORE_SERVICES = 'clientCoreServices';

// eslint-disable-next-line no-undef
module.exports = (config, options) => {
  config.plugins.push(new WebpackManifestPlugin(options));

  const singleSpaWebpackConfig = singleSpaAngularWebpack(config, options);
  const externals = singleSpaWebpackConfig.externals || [];

  externals.push(CLIENT_CORE_SERVICES);

  const mergedConfig = {
    ...singleSpaWebpackConfig,
    externals
  };

  return mergedConfig;
};

但是,当我尝试运行构建过程时,我收到以下错误消息:

Error: Module not found: Error: Can't resolve 'style-loader' in 'my-project-path'
pcww981p

pcww981p1#

问题出在single-spa-angular的版本上。
我在www.example.com找到了一个临时解决方案https://github.com/single-spa/single-spa-angular/issues/463#

相关问题