polymer-build | Moved to Polymer/tools monorepo | Web Framework library
kandi X-RAY | polymer-build Summary
kandi X-RAY | polymer-build Summary
Moved to Polymer/tools monorepo
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of polymer-build
polymer-build Key Features
polymer-build Examples and Code Snippets
Community Discussions
Trending Discussions on polymer-build
QUESTION
I am in the middle of converting a Polymer 2 app to Polymer 3. Modulizer did not work for me so I converted it manually. Thanks to the great upgrade guide it has been mostly straight forward so far.
One task is left though: in my Polymer 2 app I had a special html import (d3-import.html) that brought in the d3.js lib version 3 which comes as a plain JavaScript file (no ES6 module!). This import was dynamically loaded in only two out of overall 20 pages because the other 18 pages did not need it.
In Polymer 3 I can not import it as an ES6 module because it is not a module. Loading it in my main start.html would mean it gets loaded even if the user only uses the other 18 pages that don't need it. I tried writing script-tags in my web component templates but that doesn't seem to work. Unfortunately I don't see any error in the browser tools. The template simply stops to load at the line of the script-tags.
Any idea how to do this?
Additional question: since I start using lit-element in the same application. How to solve the same problem with lit-element?
Edit: note that I currently don't use any build steps/tools except for polymer-build to replace the module paths with actual file paths.
...ANSWER
Answered 2020-Jan-28 at 22:16Note that this challenge has nothing to do with Polymer or LitElement, this is only an issue with how to load non-module resources from a module.
The most straightforward way that I know of is to use a bundler like Rollup that can support CommonJS or UMD. Rollup has the commonjs plugin for this: https://github.com/rollup/plugins/tree/master/packages/commonjs
The other option is to upgrade to D3 5.x, which appears to be published as standard modules itself. Given the number of files involved, you'll still likely want a bundler to reduce network roundtrips.
QUESTION
For every element that I have defined in a Polymer 2.x project I get the following warning:
Multiple global declarations of class with identifier Polymer.Element
The build ultimately fails with a Promise rejection at ...\node_modules\polymer-build\lib\analyzer.js
Are these components improperly defined?
How can I properly build the project?
My polymer.json file is
...ANSWER
Answered 2018-Aug-27 at 14:28This error means that you load the same dependency from two different urls. For instance
QUESTION
I have a web dev project that is built using the polymer-cli. On my local machine, when I run polymer build within the project folder, I am able to build the project successfully.
However, if I try to build the project on Jenkins, it fails with an 'Unable to load import' error. Here is the piece of console output that outlines the error
...ANSWER
Answered 2018-Sep-05 at 15:04After much deliberation I found a solution and thought I would document it here in case anybody ever runs into the same issue.
I have a parent polymer element called baseline-policies-tab.html within which baseline-policy-edit.html is a child element. To resolve the issue, I had to add an import statement for baseline-policy-basic-info.html to baseline-policies-tab.html.
Also, I changed the import statement in baseline-policy-edit.html from
QUESTION
I'm using ES6, Promises and fetch in my Polymer 2 project. Because I need to support at least IE11, I'm transpiling with Babel (via polymer-build) and using polyfills.io to polyfill fetch and Promise support. My polyfills.io import happens before any other imports and looks like this:
When I load the page, this error appears in the IE11 console:
SCRIPT438: Object doesn't support property or method 'catch'
Looking through my code, the only time I'm using catch is in Promises. For example:
...ANSWER
Answered 2017-Aug-29 at 17:52So, it looks like catch is a reserved word in IE 9+. I found this nugget of information at https://github.com/lahmatiy/es6-promise-polyfill:
catch
is a reserved word in IE<9, meaningpromise.catch(func)
throws a syntax error. To work around this, use a string to access the property:
promise['catch'](function(err) { // ... });
Or use
.then
instead:
promise.then(undefined, function(err) { // ... });
My code works in IE11 if I modify it to avoid catch, like so:
QUESTION
...
const polymerProject = new polymerBuild.PolymerProject(polymerJson);
...
gulp.task('mytask', function()
{
const sourcesStream = polymerProject.sources();
return sourcesStream.pipe(gulp.dest('build/'));
});
...ANSWER
Answered 2017-Jun-26 at 12:48The reason for this was that in the polymer project were still some errors left. After the errors were solved, the task ended.
QUESTION
I'm trying to run gulp
to build my app like Rob Dodson explains here.
At the command line, if I run:
...ANSWER
Answered 2017-Jan-21 at 22:10The original error is unrelated to the "alternate error".
While the build
task runs gulp
, npm run
prioritizes the locally-installed gulp
(at node_modules/.bin/gulp
) before the system-installed gulp
. Running gulp
yourself (without npm run
) would invoke the globally-installed gulp
, which may result in an error if it's incompatible with your project (e.g., Gulp 3 binary with Gulp 4 API in your scripts, which appears to be the case). You could either install Gulp 4 so that you can run gulp
yourself, or continue using npm run build
.
To troubleshoot the original error, I recommend starting from the Polycast's original source (if you haven't already) to determine what the difference could be.
If you prefer to stick with your current track, I suggest a few things:
- Verify the paths in your HTML imports, as a path to a non-existent file would cause a silent error (
polymer-build
issue 88). It might be helpful to runpolymer build -v
(verbose build). - Add
buildStream.on('error', (err) => console.log(err))
afterlet buildStream = ...
in case any unsuppressederror
events crop up in that stream.
QUESTION
Can anyone point me to a tutorial that uses Polymer 2 and polymer-build
from Polymer CLI? When I use any example in the polymer-starter-kit
and use polymer serve
, it works fine; but when I use polymer build
and serve the bundled
or unbundled
directory, I get 404
errors. I have even updated to the newest alpha version of polymer-cli
.
Also, using https://github.com/tony19/generator-polymer-init-2-x-app generators have the same problem.
...ANSWER
Answered 2017-Jan-25 at 01:53I noticed a bug in the generator in that the starter-kit
subgenerator was missing a dependency on webcomponentsjs
, which would cause an error with polymer-build
. And as you discovered, polymer.json
was also missing dependencies for the polyfill support of webcomponentsjs
, which caused 404s on polyfilled browsers (such as Linux Chrome). That's all fixed now in v0.0.6
.
You'll also need a version of polymer-build
that does not try to uglify
the JavaScript, which would fail due to its inability to recognize ES6. The new-build-flags
branch of the polymer-cli
repo replaces uglify
with babili
for ES6 minification (added in PR#525). You could check out that branch and build it yourself, or you could install it from here:
QUESTION
I'm trying to run gulp
to build my app like Rob Dodson explains here, but I get the following error:
...
ANSWER
Answered 2017-Jan-21 at 04:40merge-stream
is already declared as a devDependency
in package.json
, so the error indicates either you haven't installed the dependencies, or that package is somehow deleted from your dependency store (i.e., node_modules/
).
To install only merge-stream
, you'd run this from the project's root directory:
QUESTION
Build task fails, after PR #77 which made polymer-build to run polymer-analyzer on project.sources()
.
I am using nunjucks to pre-render my templates, that's why analyzer fails.
ANSWER
Answered 2017-Jan-12 at 23:07The Polymer Analyzer supports standard JavaScript. If you're writing in some alternate syntax, you need to transform that syntax out before it hits the Analyzer. The polymer-build
library is made for this use case. You can build a Gulp pipeline and before files reach the Analyzer, perform your custom transforms.
See the polymer-build
library here: https://github.com/Polymer/polymer-build
Hope that helps!
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install polymer-build
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page