Webpack

作者: ShindouHiro | 来源:发表于2015-10-08 14:28 被阅读230次
  • 安装
install i webpack -g#全局安装
install i webpack -D#局部安装
  • 创建webpack.config.js
module.exports = {
  entry: './main.js',
  output: {
    filename: 'bundle.js'
  }
};

#main.js
require('./hello.js');
console.log('I am is main.js');

#hello.js
console.log('I am is hello.js');

#控制台
webpack
node bundle.js
Paste_Image.png
  • loaders
#webpack.config.js
npm i style-loader css-loader sass-loader autoprefixer-loader  babel-loader -D

module.exports = {
  entry: './main.js',
  output: {
    filename: 'bundle.js'
  },
  module: {
    loaders: [
      { test: /\.js$/,   loader: "babel" },
      { test: /\.scss$/, loader: "style!sass!autoprefixer!css"}
    ]
  }
};

相关文章

网友评论

      本文标题:Webpack

      本文链接:https://www.haomeiwen.com/subject/vbrncttx.html