npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stx-cli

v1.0.13

Published

vue+TypeScript application generator

Downloads

30

Readme

node版本: 18.14.2

项目和模块不在同一个目录下,需要先把模块链接到全局,然后再在项目中链接模块

$ cd xxx/project_npmlink/module1 $ npm link npm link 操作会在全局 node_modules 目录下创建一个 module-name 的超链接。

// 再去项目目录 $ cd xxx/project_npmlink/project1 // 通过包名建立链接 $ npm link module1 此时只需要指定 module-name,

参考资料: https://terwergreen.com/post/use-typescript-to-develop-a-custom-nodejs-frontend-development-scaffold-1i5fne.html#inquirer-%E5%A4%84%E7%90%86%E4%BA%A4%E4%BA%92

https://www.lanmper.cn/ts/t9947 模块化的文章

https://www.totaltypescript.com/relative-import-paths-need-explicit-file-extensions-in-ecmascript-imports

Relative import paths need explicit file extensions in EcmaScript imports

Matt Pocock Matt Pocock Oct 10, 2023

#The Error Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'.

// Relative import paths need explicit file extensions in // EcmaScript imports when '--moduleResolution' is 'node16' // or 'nodenext'.

import { example } from "./foo"; #The Solution That Doesn't Work Adding a .ts extension to the import path doesn't work, and results in the following error:

An import path can only end with a '.ts' extension when 'allowImportingTsExtensions' is enabled.

// An import path can only end with a '.ts' extension when // 'allowImportingTsExtensions' is enabled.

import { example } from "./foo.ts"; #The Solution Add the .js extension to the import path.

import { example } from "./foo.js";

Why Do We Need to Use JS File Extensions?

This error happens because you've specified moduleResolution: NodeNext. This tells TypeScript that you want your imports and exports to conform strictly to the Node spec.

The Node spec requires that you use .js file extensions for all imports and exports. This was decided so that a relative import path like ./foo.js would work both in Node and the browser.

This also simplifies Node's module resolution strategy - Node doesn't have to do any guesswork to figure out what file to import. Thanks to Gil Tayer for clarifying this for me.

#What if I don't want to use JS file extensions? Make sure you're using an external compiler, like esbuild, to compile your TypeScript code. Change your tsconfig.json to use moduleResolution: Bundler instead of moduleResolution: NodeNext.