Skip to content

Latest commit

 

History

History
40 lines (24 loc) · 1.43 KB

TEMPLATE.md

File metadata and controls

40 lines (24 loc) · 1.43 KB

Template

TODO: You should delete this file after setting up your project.

No poly-filling is performed during the library build process! When a library is consumed, the consumer must provide its own polyfills if necessary.

This template is pre-configured to build both a NodeJS version (commonjs requires) and a Webpack version (tree-shakable imports).

Depending on what kind of library you're building, you may want to make some of the following changes.

NodeJS support

Browser support

NodeJS ES Modules

  • Switch the ESLint import/extensions rule to ['error', 'ignorePackages'].

At the time of this writing, TypeScript support for NodeJS native ES modules is incomplete at best. It's probably a good idea to wait on adopting them until TypeScript has officially released support.

However, you can use the "type": "module" package option if use import paths with .js extensions, even when importing local .ts files! TypeScript will resolve the .js paths to .ts files during development.

For example, instead of the old TS import path:

import foo from './foo';

Use a JS path import:

import foo from './foo.js';
// Or, if foo is a directory...
import foo from './foo/index.js';