vue2 — 依赖项

  • 参数简写:
-i: install
-s: --save
-D: --save-dev
  • 指定版本安装
npm install [email protected] --save
  • vue
npm install vue --save
  • vue-loader
npm install vue-loader --save
  • vue-hot-reload-api/vue-html-loader/vue-loader/vue-style-loader/vue-template-compiler
npm install vue-hot-reload-api \
                  vue-html-loader \
                  vue-loader \
                  vue-style-loader \
                  vue-template-compiler \     // (vue-html-loader依赖,vue2)
                  --save-dev
  • babel
npm install babel-core \
                  babel-loader \
                  babel-plugin-transform-runtime \
                  babel-preset-es2015 \ (optional)
                  babel-preset-stage-0 \ (optional)
                  babel-runtime \
                  --save-dev
  • webpack
// 使用webpack-dev-server
npm install webpack webpack-dev-server --save-dev
// 使用webpack middleware
npm install webpack webpack-hot-middleware webpack-dev-middleware --save-dev
// webpack config合并
npm install webpack-merge --save-dev
  • sass
npm install css-loader sass-loader node-sass --save-dev 
  • 页内及图片或webfont
npm install style-loader url-loader file-loader --save-dev
  • 提取CSS到单独的css文件
npm install extract-text-webpack-plugin --save-dev
  • webpack.config.js
module.exports = {
    module: {
      loaders: [
        { test: /\.vue$/, loader: 'vue' },
        { test: /\.js$/, loader: 'babel', exclude: /node_modules/ }
        { test: /\.(png|jpg|gif)$/, loader: 'url', query: { limit: 8096, name: 'images/[name].[hash:7].[ext]' } }
      ]
    },
    vue: {
      autoprefixer: {
        browsers: ['last 2 versions']
      },
      js: '',
      html: 'raw'
    }
}

你可能感兴趣的:(vue2 — 依赖项)