Skip to content

RangeDatepickerBehavior is not defined when bundling with Webpack #54

@govis

Description

@govis

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions