Vardaccio搭建及常用命令
Vardaccio搭建及常用命令_verdaccio上传的依赖怎样删除_无名之辈程序媛的博客-CSDN博客
添加用户名:npm adduser --registry http://ip:4873 输入用户名、密码、邮箱地址,username :**** password :* **** emil :******
登陆Vardaccio:npm login --registry=http://ip:4873
创建包:npm init
发布包:npm publish --registry=http://ip:4873
删除已上传项目:npm unpublish --force yourPackage --registry http://localhost:4873
安装依赖包:npm install 包名@版本号 --registry=http://ip:4873
设置.npmrc
@group:registry=http://ip:4873
创建项目
npm init -y
设置私包名 @group/***
yarn add react-dom antd
yarn add -D file-loader ts-loader typescript ts-loader webpack webpack-cli
创建tsconfig.json
{
"compilerOptions": {
"jsx": "react",
"module": "commonjs",
"outDir": "./dist",
"target": "ES5",
"lib": ["DOM", "ES2015", "ES2017"],
"strict": false,
"esModuleInterop": true
}
}
创建webpack.config.js
// webpack.config.js
const path = require('path');
module.exports = {
entry: './src/index.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
libraryTarget: 'module',
},
experiments: {
outputModule: true,
},
module: {
rules: [
{
test: /\.(ts|tsx)?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader',
},
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
},
{
test: /\.(png|jpe?g|gif|svg)$/i,
use: [
{
loader: 'file-loader',
options: {
outputPath: 'images', // 图像输出目录
name: '[name].[ext]', // 输出文件名格式
},
},
],
}
],
},
resolve: {
extensions: ['.js', '.ts', '.jsx', '.tsx'],
},
};
设置package.json module/main
"module": "dist/index.js",
"main": "dist/index.js",
.gitignore
https://help.github.com/articles/ignoring-files/