vue+webpack 组件化开发基本配置
来源:互联网 发布:wine for mac 手柄 编辑:程序博客网 时间:2024/06/06 21:00
package.json
{ "name": "xxx", "description": "vue test", "version": "1.0.0", "author": "xxxx", "private": true, "scripts": { "dev": "cross-env NODE_ENV=development webpack-dev-server --open --hot", "build": "cross-env NODE_ENV=production webpack --progress --hide-modules" }, "dependencies": { "vue": "^2.3.3", "vue-router": "^2.7.0" }, "devDependencies": { "babel-core": "^6.0.0", "babel-loader": "^6.0.0", "babel-preset-env": "^1.5.1", "cross-env": "^3.0.0", "css-loader": "^0.28.4", "less": "^2.7.2", "less-loader": "^4.0.5", "style-loader": "^0.18.2", "vue-loader": "^12.1.0", "vue-template-compiler": "^2.4.2", "webpack": "^2.6.1", "webpack-dev-server": "^2.4.5" }}
webpack.config.js
var path = require('path')var webpack = require('webpack')module.exports = { entry: './index.js', output: { path: path.resolve(__dirname, './dist'), publicPath: '/dist/', filename: 'build.js' }, module: { rules: [ { test: /\.vue$/, loader: 'vue-loader', options: {} }, { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ }, { test: /\.css$/, loader: 'style-loader!css-loader' }, { test: /\.less$/, loader: 'less-loader' } ] }, resolve: { alias: { 'vue$': 'vue/dist/vue.esm.js' } }, devServer: { historyApiFallback: true, noInfo: true, port: 8081 }, performance: { hints: false }, devtool: '#eval-source-map'}if (process.env.NODE_ENV === 'production') { module.exports.devtool = '#source-map' // http://vue-loader.vuejs.org/en/workflow/production.html module.exports.plugins = (module.exports.plugins || []).concat([ new webpack.DefinePlugin({ 'process.env': { NODE_ENV: '"production"' } }), new webpack.optimize.UglifyJsPlugin({ sourceMap: true, compress: { warnings: false } }), new webpack.LoaderOptionsPlugin({ minimize: true }) ])}
.babelrc
{ "presets": [ ["env", { "modules": false }] ]}
阅读全文
0 0
- vue+webpack 组件化开发基本配置
- 利用webpack和vue实现组件化
- 利用webpack和vue实现组件化
- vue webpack自动化开发
- Vue+Webpack开发
- Laravel 中使用 Vue 组件化开发(配置)
- vue 多项目 依赖webpack开发共用 配置
- webpack+vue初始化项目基本
- vue实战--webpack基本使用
- vue-cli的webpack配置,迁移适用到react开发配置webpack
- vue-cli中的webpack配置
- vue + webpack 安装和配置
- Vue-webpack项目配置详解
- vue-cli中的webpack配置
- vue-cli webpack 配置分析
- vue-cli中的webpack配置
- vue-cli webpack配置分析
- vue配置 webpack构建vue项目
- 开关按钮ToggleButton和开关Switch
- 字符颠倒
- 学习笔记(二)
- Composer 版本约束表达式的使用
- sts搭建maven
- vue+webpack 组件化开发基本配置
- czl蒻蒟的OI之路7
- Linux——入门命令,基本操作
- Implement Magic Dictionary问题及解法
- UDTF实例讲解
- Java中Properties类的操作
- 从特征描述符到深度学习:计算机视觉发展20年
- 使用JS完成一个简单的计算器功能
- cookie session 和登录验证