Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeDatepickerBehavior is not defined when bundling with Webpack #54

Open
govis opened this issue Dec 1, 2017 · 1 comment
Open

RangeDatepickerBehavior is not defined when bundling with Webpack #54

govis opened this issue Dec 1, 2017 · 1 comment

Comments

@govis
Copy link

govis commented Dec 1, 2017

Ever since you introduced range-datepicker and moment dependency my Webpack-built project is getting an error:

ReferenceError: RangeDatepickerBehavior is not defined

It's coming from the RangeDatepickerInput class declaration:

class RangeDatepickerInput extends Polymer.mixinBehaviors(
  [Polymer.Templatizer],
  RangeDatepickerBehavior(Polymer.Element)
) {

It seems to me that RangeDatepickerBehavior is not available in the global context as it gets wrapped in a module by Webpack. Adding

window['RangeDatepickerBehavior'] = RangeDatepickerBehavior;
to range-datepicker-behavior.js solves the problem, but there might be more elegant solution, such as declaring a project-specific namespace for example.

Also just an FYI, moment seems to have some issues with Webpack as well:

WARNING in ./import/moment/min/moment-with-locales.min.js
Module not found: Error: Can't resolve './locale' in '...\import\moment\min'
 @ ./import/moment/min/moment-with-locales.min.js 1:8507-8529
 @ ./import/range-datepicker/moment-import.html
 @ ./import/range-datepicker/range-datepicker-input.html
 @ ./import/paper-datatable-api/paper-datatable-api-th-content.html
 @ ./import/paper-datatable-api/paper-datatable-api.html

Thanks

@govis
Copy link
Author

govis commented Dec 1, 2017

Found the moment issue related to Webpack: moment/moment#4218

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant