question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

wrangler publish fails when ESModule is used

See original GitHub issue

Hello,

I got this error when publishing my ESModule project: Cannot read properties of undefined (reading '1')

I reproduce the issue with the following files:

test.js

import './another.js'

console.log('This is a test')

another.js

console.log('This is another module')

wragnler.toml

name = 'test'
type = 'javascript'
account_id = '<ACCOUNT_ID>'
zone_id = '<ZONE_ID>'

compatibility_date = '2021-11-10'

[build.upload]
format = 'modules'
main = './test.js'

And then run npx wrangler@beta publish

The issue does not exist if another.js is not imported. I am not sure this is a bug or it is because v2 is still in beta and ESModule is not yet supported

Thank you.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
wesboscommented, Jan 18, 2022

wow awesome! Worked great - thanks a million

1reaction
petebacondarwincommented, Jan 17, 2022

You can work around this by providing the entry-point script at the command line:

npm wrangler publish index.js
Read more comments on GitHub >

github_iconTop Results From Across the Web

Deprecations · Cloudflare Workers docs
Deprecations. This document describes the difference between Wrangler 1 and 2, specifically deprecations and breaking changes.
Read more >
getting an error while publish the on cloudflare workers?
As the error says, you need to run wrangler login or wrangler config to set the credentials for your account.
Read more >
@cloudflare/wrangler | Yarn - Package Manager
init. Creates a skeleton wrangler.toml in an existing directory. This can be used as an alternative to generate if you prefer to clone...
Read more >
Building a Full-Stack Serverless Application with Cloudflare ...
When you publish a project to Cloudflare Workers, ... Once you've installed Wrangler, you can use the generate command to make a new...
Read more >
Cloudflare Workers Sites and GitHub Actions - Sam Rhea
I used Cloudflare Access and Wrangler to build a deployment pipeline that could publish a staging version of the site that was only...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found