@nxtensions/tsconfig-paths-snowpack-plugin

Snowpack plugin to use the tsconfig path mappings as aliases.

Usage no npm install needed!

<script type="module">
  import nxtensionsTsconfigPathsSnowpackPlugin from 'https://cdn.skypack.dev/@nxtensions/tsconfig-paths-snowpack-plugin';
</script>

README

@nxtensions/tsconfig-paths-snowpack-plugin

Snowpack plugin adding support for using path mappings specified in tsconfig files. This is useful for projects that use Typescript and want to reuse the defined path mappings in the tsconfig as aliases in Snowpack.

How to use

Add the plugin to your Snowpack configuration:

// snowpack.config.mjs

/** @type {import("snowpack").SnowpackUserConfig } */
export default {
  plugins: ['@nxtensions/tsconfig-paths-snowpack-plugin'],
};

By default the plugin will try to locate a tsconfig.json file relative to the Snowpack root. A custom configuration file path can be specified by specifying the tsConfig option:

// snowpack.config.mjs

/** @type {import("snowpack").SnowpackUserConfig } */
export default {
  plugins: [
    [
      '@nxtensions/tsconfig-paths-snowpack-plugin',
      { tsConfig: 'tsconfig.app.json' },
    ],
  ],
};