Skip to content

/lib and /lib-esm included in build #216

Closed
@christopherthielen

Description

@christopherthielen

From @dcarabott on January 15, 2018 10:32

After upgrading to ng5 and using @uirouter/[email protected] and @uirouter/[email protected] the build ends up including both lib and lib-esm. Bundle was inspected using source-map-explorer.

Build process:

We're using rollup with the following config:

const config = {
  input:'dist/tmp/app/main-prod',
  sourcemap: true,
  treeshake: true,
  name: 'main',
  plugins: [
    includePaths({
      paths: ['dist/tmp/app'],
      extensions: ['.js', '.json', '.html', '.ts']
    }),
    nodeResolve({
      jsnext: true,
      main: true,
      module: true
    }),
    commonjs({
      include: 'node_modules/**'
    })
  ]
}
export = (done: any) => {
  rollup
    .rollup(config)
    .then((bundle: any) =>
      bundle.generate({
        format: 'iife'
      })
    )
    .then((result: any) => {
      const path ='dist/tmp/bundle.js';
       parallel(getTasks(path, result), (error: any, results: boolean[]) => {
          if (error && results.indexOf(false) === -1) {
            console.error(error);
            process.exit(0);
          }
          done();
        });
    })
    .catch((error: any) => {
      console.error(error);
      process.exit(0);
    });
};

function getTasks(path: string, result: any): any[] {
  const tasks = [
    (callback: any) =>
      writeFile(path, result.code,
        (error: any) => callback(null, !error)
      )
  ];
  return tasks;
}

main.prod.ts

import { enableProdMode } from '@angular/core';
import { platformBrowser } from '@angular/platform-browser';

import { AppModuleNgFactory } from './app.module.ngfactory';

enableProdMode();

Previously we were using @uirouter/[email protected] and [email protected] and this issue was not observed.

The build process didn't change.

We recreated the issue on a simple POC with one parent state, a child state and a sticky state. Nothing fancy. When importing we always import using @uirouter/angular

Let me know if you would need a POC project since I can't replicate the issue on plunker.

Copied from original issue: ui-router/core#113

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