Adjust import of vendor/ modules in NPM package

We move the files in core/ up one directory level so we need to adjust
the imports from vendor libraries.
This commit is contained in:
Pierre Ossman 2017-07-04 10:10:36 +02:00
parent d5c5b4aab7
commit 1524df89ad
2 changed files with 8 additions and 0 deletions

View File

@ -30,6 +30,7 @@
"devDependencies": {
"babel-core": "^6.22.1",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-import-redirect": "*",
"babel-plugin-syntax-dynamic-import": "^6.18.0",
"babel-plugin-transform-es2015-modules-amd": "^6.22.0",
"babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",

View File

@ -131,6 +131,13 @@ var make_lib_files = function (import_format, source_maps, with_app_dir) {
if (helper && helpers.optionsOverride) {
helper.optionsOverride(opts);
}
// Adjust for the fact that we move the core files relative
// to the vendor directory
if (!in_path) {
opts.plugins.push(["import-redirect",
{"root": out_path_base,
"redirect": { "vendor/(.+)": "./vendor/$1"}}]);
}
babel.transformFile(filename, opts, (err, res) => {
console.log(`Writing ${out_path}`);