builder icon indicating copy to clipboard operation
builder copied to clipboard

Feature: Have a plugin that infers the right `require()` path.

Open ryan-roemer opened this issue 10 years ago • 1 comments

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:

  1. Need to add more require("ARCHETYPE-dev/require") missing.
  2. 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

ryan-roemer avatar Mar 23 '16 19:03 ryan-roemer

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

baer avatar Mar 23 '16 22:03 baer