Skip to content

dnt Build Issues #330

Description

@mcgear

Hopefully I am missing something simple. We have the dnt builds working in other libraries, but for some reason I can't get it to work in our new icons library: https://github.com/fathym-deno/atomic-icons

We have defined our dnt build in the ./scripts/npm.build.ts file, but we are getting the following error:

[dnt] Top level await cannot be used when distributing CommonJS/UMD (See deps/deno.land/x/fresh@1.3.1/src/server/build_id.ts 6:21). Please re-organize your code to not use a top level await or only distribute an ES module by setting the 'scriptModule' build option to false.
error: Uncaught (in promise) Error: Build failed due to top level await when creating CommonJS/UMD package.
        throw new Error(
              ^
    at build (https://deno.land/x/dnt@0.38.0/mod.ts:334:15)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async file:///C:/Users/micha_8ygdgy8/Fathym/OpenSource/fathym-deno/atomic-icons/scripts/npm.build.ts:5:1

Based on the error, it appears as though it is trying to treat npm.build.ts as the entrypoint. What am i missing in this project to get it to work?

Activity

  1. mcgear commented on Aug 10, 2023

    @mcgear
    Author
  2. zifeo commented on Sep 30, 2023

    @zifeo

    @mcgear You seems to have a top level await in your library, use scriptModule: false in dnt.build as suggested by the error message and you should be good (see here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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