Gajit
Gajit

Reputation: 133

Polymer CLI and require

I am trying to build a Polymer 3 component that has a dependency on a library that uses Node's require to function. Can I use the Polymer CLI serve and build components that have node style required file?

Upvotes: 3

Views: 346

Answers (1)

Hyyan Abo Fakher
Hyyan Abo Fakher

Reputation: 3527

Polymer uses the ES6 Module syntax and NodeJS uses CommonJS Module syntax module.exports not ES6 module syntax export keyword.

So it is not possible by default to use the nodejs require within polymer project. Rob Dodson from the polymer team created an experimental project to achieve what you are looking for, but it seems the project did not see the light

Upvotes: 3

Related Questions