Skip to content

excludes in JS minify being skipped #279

@Westbrook

Description

@Westbrook

I've get a situation very close to https://github.com/Polymer/polymer-cli/issues/701 and while I've applied the approach added via Polymer/polymer-cli#952 I'm noticing that the files in question are still being minified in a way that triggers errors in the Firebase code.

Tracking through the build/cli code I noticed that when the files are entering the getOptimizeStreams section of the build pipeline, the file was being tracked with a rewritten file.pathName such that file. relative would return an unmatchable file name when passed to notExcluded for comparison. The can be experienced via https://github.com/Westbrook/polymer-build-filenames which outlines the steps to see this in action.

Upon further review with some help from @justinfagnani I realized that all the the JS files, no matter their origin, were being seen as isInline === true at https://github.com/Polymer/tools/blob/master/packages/build/src/html-splitter.ts#L189 which would clearly cause this issue. It seems be happening because bundle is occurring before getOptimizeStreams here https://github.com/Polymer/tools/blob/master/packages/cli/src/build/build.ts#L84 It seems that this issue can be avoided by moving the if (bundled) { block to just before the if (options.basePath) { block here https://github.com/Polymer/tools/blob/master/packages/cli/src/build/build.ts#L128 and wanted to see if that made sense to someone more knowledgable on this project that I.

I'd be happy to PR this if you'd like, though I know there is lots of dev going against this right now. Either way let me know if I can help get the right fix for this into the codebase!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions