思路是在webpack裏postcss-loader不對庫的文件起做用。通過嘗試配置以下:css
{ test: /\.(css|less)$/, use: [ require.resolve('style-loader'), { loader: require.resolve('css-loader'), options: { sourceMap: true, importLoaders: 1, }, }, { loader: require.resolve('postcss-loader'), options: postcssOptions, }, { loader: require.resolve('less-loader'), options: { sourceMap: true, modifyVars: lessModifyVars, }, }, ], exclude: /node_modules/, }, { test: /\.(css|less)$/, use: [ require.resolve('style-loader'), { loader: require.resolve('css-loader'), options: { sourceMap: true, importLoaders: 1, }, }, { loader: require.resolve('less-loader'), options: { sourceMap: true, modifyVars: lessModifyVars, }, }, ], },
顯示就是正常的了。node