Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack搭建vue项目实践 #7

Open
include-all opened this issue Apr 21, 2020 · 0 comments
Open

webpack搭建vue项目实践 #7

include-all opened this issue Apr 21, 2020 · 0 comments

Comments

@include-all
Copy link
Owner

include-all commented Apr 21, 2020

内容主要参考自掘金文章:面试官:自己搭建过vue开发环境吗?
相当于自己实践中的注释,看下面的需要结合上面的文章去看

一、搭建webpack基本环境

  1. npm init

初始化一个x项目,生成package.json

2.安装webpack

npm install webpack webpack-cli -D
安装webpack和webpack-cli,
-S 生产环境; -D开发环境;-g全局环境;
npm install -g 和npm install --save-dev的关系

3.测试demo

console.log('hello webpack');

console.log(process.env.NODE_ENV);
//此时执行 npm run serve,生成的文件会打印出hello webpack  development,
//这就是webpack的模式(mode),会将process.env.NODE_ENV赋值为development或production

注意mode值只支持 development,production和none

webpack ./src/main.js --config ./build/webpack.config.js
--config意味使用什么配置文件

babel配置:babel.config.js与.babelrc的区别
babel的几个依赖的区别:@babel/preset-env, @babel/polyfill和@babel/plugin-transform-runtime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant