解决antd-mobile样式被postcss转换的问题

思路是在webpack里postcss-loader不对库的文件起作用。经过尝试配置如下:

{
                        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,
                                },
                            },
                        ],
                    },

显示就是正常的了。

原文链接:segmentfault.com

上一篇:yoghurt
下一篇:runnercamp-react-native

相关推荐

官方社区

扫码加入 JavaScript 社区