Snowpack: Move mount configuration out of build scripts

Created on 12 Jun 2020  路  5Comments  路  Source: snowpackjs/snowpack

Follow-on from https://github.com/pikapkg/snowpack/issues/441

Previously, we moved proxy configuration out of the build "scripts" configuration and into its own, devOptions.proxy configuration object. This gave users a lot more control/customization options over their proxy, without much added overhead.

I think that feature, and the similar feedback we've gotten around "mount" scripts, may mean that "mount" logic could benefit from a similar move out of build "scripts" and into a top-level mount config.

// snowpack.config.json (bikeshed-able example)
module.exports = {
  mount: {
    'src': '/_dist_/',
    'public': '/',
    'web_modules': '/static/web_modules/',
  }
}

I don't think this is a high priority, since it's purely a syntax change and not unblocking anyone that's blocked today, but given that "mount" is the last build script left that isn't actually about building/transforming files, I do think this would be valuable work.

Open to a PR if anyone is interested in tackling!

good first issue help wanted

Most helpful comment

OK, great. Thanks for the explanation. I see that #567 has been merged. While it's simmering, I'll try to find some time to get familiar with the codebase. By the way, great work on snowpack. I'm really excited about it!

All 5 comments

I'm just getting my feet wet with snowpack and was wondering if the 'mount' script is equivalent to webpack's resolve.alias? If so, having it as a top-level 'mount' config could be helpful for a project I'm working on and would be interested at taking a stab at this issue.

It's somewhat similar, yes. The difference is that we use mount to customize how different files on disk should be written to URL. For example in the snippet above, all files inside of src/* will be hosted at localhost:8080/_dist_/* during development.

We'd love your help on this! Although I would recommend waiting a bit until #567 is merged, which does move the codebase a step closer to this concept internally. Once that's had a few days to bake a bit, it should be an easy task to implement this issue.

OK, great. Thanks for the explanation. I see that #567 has been merged. While it's simmering, I'll try to find some time to get familiar with the codebase. By the way, great work on snowpack. I'm really excited about it!

Addressed in #626

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gr2m picture gr2m  路  6Comments

FredKSchott picture FredKSchott  路  5Comments

backspaces picture backspaces  路  5Comments

FredKSchott picture FredKSchott  路  4Comments

daniele-orlando picture daniele-orlando  路  6Comments