Buslowicz / twc

TypeScript based, boilerplate-less, Polymer toolbox friendly Polymer Modules
32 stars 1 forks source link

Configurable path prefixes #120

Closed adaliszk closed 6 years ago

adaliszk commented 6 years ago

Currently npm, bower and yarn are the possible prefixes in the imports. I whish to extend it so the the application cloud define more in some way. Currently this is resolved with the paths and sure you can override the locations with environment variables but you cannot add more shortcuts.

const paths = {
  npm: process.env.npmDir || "node_modules",
  bower: process.env.bowerDir || bowerRc.directory || "..",
  yarn: process.env.yarnDir || "node_modules"
};

What I wish to have is a local which should point to the element location and add some configurable way to add items to this object.

adaliszk commented 6 years ago

oh, sorry: the local is the ~ so that part is not needed :blush:

Buslowicz commented 6 years ago

I will make those configurable anyway, as some use cases might have a completely different architecture and files structure.

adaliszk commented 6 years ago

I usually have some rewrites about the urls and I usually have a resolver code which notify me whenever somebody want to sniff around. My usual url structure:

/@modules => /node_modules
/@components => /bower_components
/@elements => /elements (app related elements, not just building blocks)
/@polymer => /node_modules/@polymer/polymer
/@polyfill => /node_modules/@webcomponentsjs/webcomponentsjs

And they have separate service workers some time to serve and cache that urls.