[storage-blob] cannot import in to commonjs project #31695
Labels
Client
This issue points to a problem in the data-plane of the library.
customer-reported
Issues that are reported by GitHub users external to the Azure organization.
needs-author-feedback
Workflow: More information is needed from author to address the issue.
no-recent-activity
There has been no recent activity on this issue.
question
The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Service Attention
Workflow: This issue is responsible by Azure service team.
Storage
Storage Service (Queues, Blobs, Files)
Describe the bug
We have a Typescript project which outputs CommonJS JS. We are trying to use the storage-blob sdk but running in to import issues.
We cannot simply change our project to an ES module as this caused a myriad of other dependencies to break (and much of the current NPM landscape is still CommonJS so I would expect MS to be able to support this).
We tried to import @azure/storage-blob in a few ways:
import ... from
: gave an error thatimport cannot be used outside of a ES module
. Somewhat expected given the typescript documentation. So on to attempt 2require
: create a .js file instead of .ts, use requireconst { BlobServiceClient } = require("@azure/storage-blob")
as per javascript documentation.This however caused the following error:
To Reproduce
Steps to reproduce the behavior:
const { BlobServiceClient } = require("@azure/storage-blob")
Expected behavior
@azure/storage-blob package is successfully imported and usable within the file
The text was updated successfully, but these errors were encountered: