问答详情
源自:4-5 使用 less 和 sass

课程里关于webpack的配置是低版本的,对高版本的不适用?

课程里关于webpack的配置是低版本的,对高版本的不适用?

提问者:qq_啊啦嘞_0 2018-09-19 21:50

个回答

  • 慕移动9181930
    2022-03-27 14:48:04

    说得很清楚啊,/Applications/Xcode6-Beta2.app/Contents/Developer这个位置找不到,beta3你改成beta3的目录就好了,不要告诉我你不知道哦怎么用3替换2.x100 = x1  (n - 1)*d

  • 奋斗的乐儿
    2018-12-07 14:38:22

    这里的配置webpack4下是可以运行的

    var htmlWebpackPlugin = require('html-webpack-plugin');
    module.exports = {
        mode: 'development',
        entry: __dirname + '/src/app.js',
        output: {
            path: __dirname + "/dist",
            filename: "js/[name].bundle.js",
        },
        module: {
            rules: [
                {
                    test: /\.js$/,
                    exclude: '/node_modules/',
                    loader: "babel-loader"
                },
                {
                    test: /\.css/,
                    use: [
                        'style-loader',
                        'css-loader?importLoaders=1',
                        {
                            loader: 'postcss-loader',
                            options: {
                                plugins: [
                                    require('autoprefixer')({
                                        browsers: [
                                            "last 10 version"
                                        ]
                                    }),
                                ],
                            }
                        }
                    ]
                },
                {
                    test: /\.less$/,
                    use: [
                        'style-loader',
                        'css-loader',
                        {
                            loader: 'postcss-loader',
                            options: {
                                plugins: [
                                    require('autoprefixer')({
                                        browsers: [
                                            "last 10 version"
                                        ]
                                    }),
                                ],
                            }
                        }, {
                            loader: "less-loader", options: {
                                sourceMap: true
                            }// compiles Less to CSS
                        }]
                },
                {
                    test: /\.scss$/,
                    use: [
                        "style-loader", // creates style nodes from JS strings
                        "css-loader",
                        {
                            loader: 'postcss-loader',
                            options: {
                                plugins: [
                                    require('autoprefixer')({
                                        browsers: [
                                            "last 10 version"
                                        ]
                                    }),
                                ],
                            }
                        },// translates CSS into CommonJS
                        "sass-loader" // compiles Sass to CSS, using Node Sass by default
                    ]
                }
            ]
        },
        plugins: [
            new htmlWebpackPlugin({
                filename: 'index.html',
                template: './src/index.html',
                inject: 'body'
            })
        ]
    }


  • qq_断弦能否弹奏出美妙的乐章_0
    2018-09-21 09:35:36

    有的是适用的,只不过在安装的时候,需要局部安装一下