Skip to content

ESBuild fails without @babel/runtime #451

@adz

Description

@adz

Using esbuild without @babel/runtime causes yarn to fail to build when including amplitude-js.

It appears this commit moved @babel/runtime from dependencies to devDependencies:
313533d

Expected Behavior

Build should be successful.

Current Behavior

----- > node_modules/amplitude-js/amplitude.esm.js:1:26: error: Could not resolve "@babel/runtime/helpers/objectSpread" (mark it as external to exclude it from the bundle)
    1 │ import _objectSpread from '@babel/runtime/helpers/objectSpread';
      ╵                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/amplitude-js/amplitude.esm.js:2:28: error: Could not resolve "@babel/runtime/helpers/defineProperty" (mark it as external to exclude it from the bundle)
    2 │ import _defineProperty from '@babel/runtime/helpers/defineProperty';
      ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/amplitude-js/amplitude.esm.js:4:20: error: Could not resolve "@babel/runtime/helpers/typeof" (mark it as external to exclude it from the bundle)
    4 │ import _typeof from '@babel/runtime/helpers/typeof';
      ╵                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/amplitude-js/amplitude.esm.js:5:31: error: Could not resolve "@babel/runtime/helpers/toConsumableArray" (mark it as external to exclude it from the bundle)
    5 │ import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
      ╵                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/amplitude-js/amplitude.esm.js:6:28: error: Could not resolve "@babel/runtime/helpers/classCallCheck" (mark it as external to exclude it from the bundle)
    6 │ import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
      ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 > node_modules/amplitude-js/amplitude.esm.js:7:25: error: Could not resolve "@babel/runtime/helpers/createClass" (mark it as external to exclude it from the bundle)
    7 │ import _createClass from '@babel/runtime/helpers/createClass';
      ╵                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

6 errors
child_process.js:800
    throw err;
    ^

Error: Command failed: /home/adam/projects/timesheets4/amplitude-esbuild/node_modules/esbuild-linux-64/bin/esbuild --bundle index.js
    at checkExecSyncError (child_process.js:760:11)
    at Object.execFileSync (child_process.js:797:15)
    at Object.<anonymous> (/home/adam/projects/timesheets4/amplitude-esbuild/node_modules/esbuild/bin/esbuild:108:26)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 425330,
  stdout: null,
  stderr: null
}
error Command failed with exit code 1.

Possible Solution

Move babel/runtime to dependencies in package.json.

Steps to Reproduce

See repro:
https://github.com/adz/amplitude-esbuild/tree/main

Environment

  • Installation Method: yarn/esbuild

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions