做者:robert 仓库地址:gitee.com/dawwdadfrf/…css
最近在学习element的源码,想着学习element的时候来顺便把webpack,css,ts方面的知识也学一学,由于是第一次分享,过程当中可能存在着不少的不足之处。请你们多多指教。本项目适用于小伙伴入门,文章将持续更新vue
- 安装node环境
- 安装npm环境
- 建立build空文件
- 建立src空文件
- 建立.npmrc文件,文件内容以下
registry=https://registry.npm.taobao.org
disturl=https://npm.taobao.org/dist
sass_binary_site=https://npm.taobao.org/mirrors/node-sass
electron_mirror=https://npm.taobao.org/mirrors/electron/
PUPPETEER_DOWNLOAD_HOST=https://npm.taobao.org/mirrors
复制代码
- npm install webpack-cli --save-dev
- npm install webpack --save-dev
console.log('123')
复制代码
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, '../dist')
}
}
复制代码
{
"name": "share-ui",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack --config build/webpack.config.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11"
}
}
复制代码
此时目录结构中会多出一个dist目录和在dist目录下面多了bundle.jsnode
以上内容若有遗漏错误,欢迎留言 ✍️指出,一块儿进步💪💪💪
若是以为本文对你有帮助,🏀🏀留下你宝贵的 👍
下一篇:webpack启动本地服务到加载vue文件