Skip to content

2.3.0

Latest
Compare
Choose a tag to compare
@bmomberger-bitovi bmomberger-bitovi released this 09 Jun 16:04
  • importRewrites is a new feature in steal config. It is similar to map with these differences:
    • it is always scoped to an npm package
    • it does a straight text replacement of imports prior to normalizing

Here's a practical example: given an old jQueryUI widget, which we'll call this-old-jquery-ui-plugin, has a file that references an old jQueryUI naming convention for the widget library:

    if (typeof define === 'function' && define.amd) {
        // Register as an anonymous AMD module:
        define([
            'jquery',
            'jquery.ui.widget'
        ], factory);
    } 

However, we are using a jquery-ui version that has been published with a different file structure, and jquery.ui.widget.js is no longer a valid file path. We want that import to point to the prior-to-normalized path jquery-ui/ui/widget.js instead. To do this, add the following to the steal section in package.json:

  "importRewrites": {
      "this-old-jquery-ui-plugin": {
        "jquery.ui.widget": "jquery-ui/ui/widget"
      }
  }

With this config, all of the imports of jquery.ui.widget in this npm package will be renamed to jquery-ui/ui/widget and then normalized to e.g. [email protected]#ui/widget.

Note that wildcards are not supported in importRewrites; only exact string matches of import specifiers will be replaced.

PR: #1522
Also in this release:

  • iOS safari fix for steal.clone(): e732dc4
  • Updates to dependencies: #1525