Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Does not work as an npm module #364

@kornelski

Description

@kornelski

package.json contains:

  "main": "dist/zone-node.js",
  "browser": "dist/zone.js",

which points to a Webpack-compiled files, which are not CommonJS module files and do not export anything. This is because Webpack-built bundles are reduced to be fully encapsulated vanilla JS files, and not CJS modules.

The effect of this is that require('zone.js') in Node does nothing — returns {} instead of Zone's public symbols. Similarly when require('zone.js') is used in 3rd party's Webpack build, it will end up running Webpack runtime inside Webpack runtime, instead of importing the module.

$ node
require('zone.js')
{}
require('zone.js').Zone
undefined

The main and browser fields must point to CJS modules that do not have Webpack runtime, and have module.exports = … statements instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions