当前位置 : 主页 > 网络编程 > JavaScript >

webpack资料

来源:互联网 收集:自由互联 发布时间:2021-06-28
gistfile1.txt 第一节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-tra
gistfile1.txt
第一节
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']

  }
网友评论