Skip to content

Uncaught ReferenceError: require is not defined #2099

Closed
@nadirowski

Description

@nadirowski

Please provide us with the following information:

  1. OS?
    Windows 10.
  2. Versions.
    angular-cli: 1.0.0-beta.11-webpack.8
    node: 6.3.1
    os: win32 x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    Migrated application from previous angular-cli to angular-cli@webpack,
    Migrated application from angular2-rc4 to angular-rc5
  4. The log given by the failure. Normally this include a stack trace and some
    more information.

VM627:11Uncaught ReferenceError: require is not defined(anonymous function) @ VM627:11e.exports @ scripts.4c654bc….bundle.js:1460 @ scripts.4c654bc….bundle.js:1__webpack_require__ @ inline.js:1888 @ scripts.4c654bc….bundle.js:1__webpack_require__ @ inline.js:1window.webpackJsonp @ inline.js:1(anonymous function) @ scripts.4c654bc….bundle.js:1

  1. Mention any other details that might be useful.

I'm trying to create a production bundle that will be served by nginx by doingng build --env=tst --target=production
Development environment working fine when using ng serve

Snippet from my package.json

 "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },

Thanks! We'll be in touch soon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions