当我使用Webpack构建模块时,我收到一串错误。我找不到任何文档来说明这个错误的含义。
Webpack Error: Module build failed: Error: Environment [object Object] not supported
该模块加载的一个库包含一个带有React组件的lib
目录,每个目录都有一个与之关联的样式表。每个样式表都有一个错误。以下是其中一个错误:
ERROR in ./~/css-loader?{"localIdentName":"[name]__[local]--[hash:base64:5]","minimize":true}!./~/postcss-loader!../some-lib/lib/plugins/importGalleryImages/components/ItemList/ItemList.css
Module build failed: Error: Environment [object Object] not supported
at module.exports (/Users/me/Documents/Personal/Code/Repos/project/webpack.server.config.js:94:9)
at /Users/me/Documents/Personal/Code/Repos/project/node_modules/postcss-load-config/index.js:58:50
@ ../some-lib/lib/plugins/importGalleryImages/components/ItemList/ItemList.css 4:14-185
@ ../some-lib/lib/plugins/importGalleryImages/components/ItemList/ItemList.js
@ ../some-lib/lib/plugins/importGalleryImages/components/Renderer/Renderer.js
@ ../some-lib/lib/plugins/importGalleryImages/config.js
@ ../some-lib/lib/index.js
@ ./app/js/server.jsgogh/lib/plugins/importGalleryImages/components/ItemList/ItemList.css 4:14-185
@ ../sb-van-gogh/lib/plugins/importGalleryImages/components/ItemList/ItemList.js
@ ../sb-van-gogh/lib/plugins/importGalleryImages/components/Renderer/Renderer.js
@ ../sb-van-gogh/lib/plugins/importGalleryImages/config.js
@ ../sb-van-gogh/lib/index.js
@ ./app/js/server.js
我关于样式表的Webpack配置是:
{
module: {
rules: [
{
test: STYLES_REGEX,
include: includePaths,
exclude: globalPath,
// Extract CSS
loader: ExtractTextPlugin.extract({
fallbackLoader: 'style-loader',
// Note: that there is no need for styles-loader as we don't want to convert styles
// to JS
loader: [
{
loader: 'css-loader',
options: {
// Use CSS Modules
modules: useModules,
localIdentName: '[name]__[local]--[hash:base64:5]',
// Minimise output using cssnano.
// Note: An object can also be passed containing config options
minimize: true,
},
},
{
loader: 'postcss-loader',
},
],
}),
},
],
},
};