Webpack 教程资料

JellyBool

JellyBool

第一节

webpack.config.js :

module.exports = {

    devtool: "sourcemap",

    entry: "./js/entry.js",

    output: {

        filename:"bundle.js"

    }

};

第二节

npm 安装相关 loader:

css-loader style-loader babel-core babel-loader babel-plugin-transform-runtime babel-preset-es2015 babel-preset-stage-0 babel-runtime --save-dev

webpack.config.js :

module.exports = {

    devtool: "sourcemap",

    entry: "./js/entry.js",

    output: {

        filename:"bundle.js"

    },

    module: {

        loaders: [

            {

                test: /\.css$/,

                loader: "style!css"

            }

        ]

  }

};

babel 配置:

babel: {

     presets: ['es2015','stage-0'],

     plugins: ['transform-runtime']

  }
本文由 JellyBool 创作, 转载和引用遵循 署名-非商业性使用 2.5 中国大陆 进行许可。

共有 1 条评论

singee

第一节 webpack 安装使用 webpack@1 可以保证最大一致性
第二节 babel-loader 需要使用 babel-loader@6

不过还是希望可以更新一下课程。。。Webpack 4 已经出了本系列课还停留在 1