This is a simple plugin that will use the paths you have defined in your tsconfig.json in your snowpack configuration.
I would recommend to use another pugin (see alternatives), since this is the first npm package that I have published. And I can't guarantee that it will work in every usecase.
snowpack.config.json
"plugins": [
["tsconfig-paths-snowpack-plugin", {/* See Options */}],
],
tsconfig.json
{
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@app/*": ["src/*"]
},
}
}
will be converted at build time into:
snowpack.config.js
module.exports = {
alias: {
"@app": "src"
}
}
Field | Type | Required | Description |
---|---|---|---|
logAlias |
bool | No | This will print the modified alias of your snowpack configuration. Keep in mind that you have to set devOptions: { output: 'stream' } in your snowpack.config.js to prevent snowpack from clearing the console. |
If you have any ideas to improve the project, feel free to do so.
- @nxtensions/tsconfig-paths-snowpack-plugin
- I also recommend viteJs and its plugin: aleclarson/vite-tsconfig-paths