Skip to content

Webpack: require function is used in a way in which dependencies cannot be statically extracted #1169

@ElsewhereGames

Description

@ElsewhereGames

Bug, feature request, or proposal:

Bug

What is the expected behavior?

To be able to build an Angular Material 2 project using webpack without warnings or errors.

What is the current behavior?

While I was able to build a webpack-based project using the previous public release (2.0.0-alpha.7-4 I believe?), upgrading to 2.0.0-alpha.8 results in the following:

WARNING in ./~/@angular2-material/core/core.js
Critical dependencies:
12:24-31 require function is used in a way in which dependencies cannot be statically extracted
 @ ./~/@angular2-material/core/core.js 12:24-31

The warning is generated for all Material 2 javascript files (including .umd.js files). The main issue that this warning triggers webpack into trying to include all files in the directory the javascript file lives in (including .json and .md files for example) which causes the build to fail.

What are the steps to reproduce?

Build a Angular Material 2 project using webpack.

What is the use-case or motivation for changing an existing behavior?

N/A

Which versions of Angular, Material, OS, browsers are affected?

  • Angular: 2.0.0-rc.6
  • Material 2: 2.0.0-alpha.8
  • Typescript: 2.0.0
  • Webpack: 1.31.2

Is there anything else we should know?

I also tried webpack 2 to see if that would help, but it causes the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions