Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

nutui-react

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nutui-react

react版本组件库

Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

react-ui

react版本组件库

问题1

npm link 可以运行的代码,但是npm publish之后,在npm i之后确无法在本地运行,要考虑以下方面:

  • 本地安装 "@babel/preset-react": "^7.9.4" 环境,配置babel.config.js文件
const presets = [
	[
		'@babel/preset-react',
		{
			loose: true,
			modules: false,
		},
		'react'
	],
];
const plugins = [];
module.exports = { presets, plugins };
  • 由于路径问题可能会导致找不到 package.json 文件,所以生成的react-cli包的名字带有文件夹/文件名: "name": "@zhenyulei/react-myclis"
  • webpack的配置项也要修改:
{
    test: /\.(js|tsx|ts)$/,
    use: [
        'cache-loader',
        'babel-loader',
        {
            loader: 'ts-loader',
            options: {
                allowTsInNodeModules: true 
            },
        },
    ],
    include: [ROOT_PACKAGE_PATH('src'), ROOT_PACKAGE_PATH('types'), ROOT_CLI_PATH('site'), ROOT_CLI_PATH('src')],
},

先用include限制使用ts-loader;再增加ts-loader的options:allowTsInNodeModules: true 允许ts编译 NodeModules 的文件;

FAQs

Package last updated on 20 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts