Skip to content

Unable to exclude modules #1279

@odurand75

Description

@odurand75

Hi!

Trying to exclude a module in vain.

Steps to reproduce

> ncc build main.js -e module1 -o .\dist\

Actual result

  • The code from the excluded module is included in index.js
  • The module object is removed

Example

main.js

import * as module1 from './module1.mjs';

let myVar = module1.myFunction();

module1.mjs

export function myFunction(){
    return null;
}

index.js

function myFunction(){
    return null;
}

let myVar = myFunction();

Expected results

  • The code from the excluded module is not included in index.js
  • The module object is left as is

Example

main.js

import * as module1 from './module1.mjs';

let myVar = module1.myFunction();

module1.mjs

export function myFunction(){
    return null;
}

index.js

let myVar = module1.myFunction();

Notes:

  • Code is nodejs with ES Module imports / exports
  • Documentation is not clear as to how to declare module in the command line. I have tried to put the module name only, the module with the path, single quote, extension, etc...
  • Debug option (-d) does not seem to work easier (nothing displayed)
  • ncc version 0.38.3
  • My modules are named with the .mjs extension
  • I have also used JSDoc @module in the module header
  • Same result with the --external option

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