Skip to content

Get rid of require() in vendor.ts #236

Closed
@antonmoiseev

Description

@antonmoiseev

Currently vendor.ts uses require() to import the enableProdMode function from angular2/core:

if ('production' === process.env.ENV) {
  let ngCore = require('angular2/core');
  ngCore.enableProdMode();
}

Can we combine the function import together with the ES6 import statement below in the file?

//...
import 'angular2/http';
import {enableProdMode} 'angular2/core';

if ('production' === process.env.ENV) {
  enableProdMode();
}

My understanding is that all required objects from angular2/core still will be bundled since the application code explicitly imports everything it needs. However I lack the knowledge of Webpack's bundling process and concerned that some of the objects from angular2/core can leak into the bundle.js file instead of being in vendor.bundle.js.

I did a quick experiment it seems that everything is fine, works as intended, but maybe I'm missing a common case when it won't work. What do you think?

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