演示存储库链接: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'
1条答案
按热度按时间pcww981p1#
问题出在
single-spa-angular
的版本上。我在www.example.com找到了一个临时解决方案https://github.com/single-spa/single-spa-angular/issues/463#