builder
builder copied to clipboard
Feature: Have a plugin that infers the right `require()` path.
Assuming we do this to fix #107 --
// ARCHETYPE-dev/require.js
module.exports = require;
// Meanwhile, in archetype JS files...
// ARCHETYPE/config/webpack/webpack.config.js
"use strict";
{
babel: require("ARCHETYPE-dev/require").resolve("babel-loader")
}
there is a risk that we:
- Need to add more
require("ARCHETYPE-dev/require")missing. - Remove existing
require("ARCHETYPE-dev/require")that have a dep switching to prod archetype.
Task
- [ ] Write an inference tool that detects either situation 1 or 2 above.
- [ ] Optionally, rewrite existing code to do the correct type of
require. - [ ] Decide where to implement. Probably
builder-support, not here.
/cc @baer
This should be pretty straight forward as a babel plugin. https://github.com/lodash/babel-plugin-lodash should be a good place to look at how that might work