Polymer / tools

Polymer Tools Monorepo
BSD 3-Clause "New" or "Revised" License
430 stars 200 forks source link

[polymer-build] Rewriting ES6 imports not working programatically #3477

Open TvrtkoM opened 4 years ago

TvrtkoM commented 4 years ago

Hello, I need help :)

Polymer cli command polymer build works fine. but I'm trying to make a script (gulp) to do this:

const polymerProject = new polymerBuild.PolymerProject(polymerJson);
gulp.task('polymer-build', () => {
  const outDir = './build';
  return new Promise((resolve, reject) => {
    rimraf(outDir, () => {
      let buildStream = merge(polymerProject.sources(), polymerProject.dependencies());
      buildStream = buildStream.pipe(gulp.dest(outDir));
      resolve(waitFor(buildStream));
    });
  });
});

polymer json:

{
  "entrypoint": "./index.html",
  "npm": true,
  "moduleResolution": "node",
  "basePath": true,
  "autoBasePath": true,
  "sources": [
   "dist/**/*",
   "!dist/**/*.spec.js",
   "./node_modules/@polymer/*/**",
   "./node_modules/@develop/demo-snippet/*/**"
  ],
  "extraDependencies": [
    "./node_modules/numbro/dist/numbro.min.js",
    "./node_modules/@webcomponents/**/*",
    "./node_modules/web-animations-js/web-animations-next-lite.min.js",
    "./node_modules/@granite-elements/ace-widget/ace-widget.js",
    "./node_modules/@styles/common/*/**",
    "./node_modules/ace-builds/src-min-noconflict/mode-html.js",
    "./node_modules/ace-builds/src-min-noconflict/theme-dawn.js",
    "./node_modules/ace-builds/src-min-noconflict/worker-html.js",
    "./node_modules/ace-builds/src-noconflict/ace.js",
    "./node_modules/ace-builds/src-noconflict/ext-language_tools.js",
    "./node_modules/ace-builds/src-noconflict/snippets/snippets.js"
  ]
}

when i run gulp polymer-build .js files are left untouched. All imports are absolute and I need them rewritten to e.g ../../@polymer/polymer-element just like polymer-cli build command does.

Please help. It is urgent

TvrtkoM commented 4 years ago

it is a polymer 3 project

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.