Skip to content

Unable to import properly in Angular Cli project #1

@Xample

Description

@Xample

I get the following error

./~/geomath/math/vector2.js
3:24-31 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

My understanding is Angular CLI is building the project using webpack which one perhaps tries to do tree shaking. In your code you are importing other modules using require. Probably this problem could be solved if you simply import them instead of using require

i.e. (for instance)

import base = require("./base");

would become

import * as base = from "./base";

https://stackoverflow.com/a/33933859/532695

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