[Discuss] Standardize alias support #923
Replies: 4 comments 3 replies
-
Here's where I land: 🟥 Inner-Package Files/Assets: This feels like the least useful to me, considering we already support aliasing to the package itself. In the example above, you're only saving a few characters vs. the already supported ✅ File: If we already support aliasing to a directory, this feels like something that we should also support and it feels like a strange line to draw that you can import directories but not files. I also hope that It wouldn't be too difficult to implement. 🟨 URL: This is one that I literally cannot wait to support conceptually ( |
Beta Was this translation helpful? Give feedback.
-
Related question... I'm trying to install a package with snowpack that lives outside/"above" the main directory. Is this currently possible? This would be especially useful in a monorepo. For example, say I have a monorepo at module.exports = {
alias: {
'my-other-package': '../my-other-package'
}
} or some variation to get access to I appreciate your help. And I absolutely love Snowpack. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure which case this falls under, if any, but in trying to use Snowpack for local demos in the directory for a library (not an application) I'd like to be able to alias my own library, so the demo uses the same imports that my users would need. For example: Project structure:
<!-- demo.html -->
<script type="module">
import { MyLibrary } from 'my-library';
import { MySubpackage } from 'my-library/packages/subpackage.js';
</script> Using this alias... {
"alias": {
"my-library": "./"
}
} ... correctly loads |
Beta Was this translation helpful? Give feedback.
-
It might also be nice to support an aliasing config option similar |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Background
Currently, we support two kinds of import aliases:
{"react": "preact/compat"}
{"@app": "./src"}
We have had requests for several improvements to this system:
{"fasvgs": "@fortawesome/fontawesome-free/svgs"}
{"confetti": ./local/confetti.js"}
{"confetti": "https://cdn.skypack.dev/canvas-confetti"}
Todo
What do we support? What do we not support? Let's come up with an answer, document it, and get proper error messages.
Beta Was this translation helpful? Give feedback.
All reactions