Skip to content

TypeScript path aliases not working correctly #1685

Discussion options

You must be logged in to vote

The following works, using Snowpack 3.0.5:
snowpack.config.js

/* eslint-env node */
/** @type {import("snowpack").SnowpackUserConfig } */
module.exports = {
  mount: {
    public: "/",
    src: "/_dist_",
  },
  plugins: ["@snowpack/plugin-typescript", "@snowpack/plugin-webpack"],
  packageOptions: {
    types: true,
  },
  devOptions: {
    port: 8000,
  },
  buildOptions: {
    out: "dist",
    sourcemap: true,
  },
  alias: {
    "~": "./src",
    "~/public": "./public",
  },
};

tsconfig.json

{
  "compilerOptions": {
    "module": "esnext",
    "target": "esnext",
    "strict": true,
    "noImplicitAny": false,
    /* noEmit - We only use TypeScript for type checking. */
    "noEmit": t…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by ivancuric
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants