Gets JavaScript
importRewrites
is a new feature in steal config. It is similar to map
with these differences:
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: https://github.com/stealjs/steal/pull/1522 Also in this release:
Fixes ES module detection when there are comments within strings and single line minified modules.
{
"steal": {
"forceES5": false // defaults to true
}
}
when set to false, Steal.js does not include the ES2015 preset. This is useful when the target browser supports all of the syntax/features transpiled by the ES2015 preset.
This enhances the warning in the console by adding which file tries to import a missing package like is showing in the following screenshot:
#1463
Fixes an issue where a module loading a dependency by its exact npm module name might load the wrong package version and error out.
This is a patch release, which adds names to all of the extension functions to make them easier to debug.
This fixes a false positive JSON parse warning in production when a JSON module is loaded from another bundle.