Git Product home page Git Product logo

Comments (3)

future-ota3727 avatar future-ota3727 commented on September 27, 2024 1

@mshrtsr
Thank you for your reply.
I hope you find a good solution.

P.S.
I missed the Japanese issue.
Thank you for relating it.

from js-sdk.

tasshi-me avatar tasshi-me commented on September 27, 2024

Related issue: kintone/js-sdk-ja#41

from js-sdk.

tasshi-me avatar tasshi-me commented on September 27, 2024

@future-ota3727
Thank you for your feedback!

That is the unexpected behavior of esbuild and dual package, and we are still looking for a fundamental solution.
You can see the details of that behavior and workaround at https://zenn.dev/sosukesuzuki/articles/d8220ba2d869f0.

There are three workarounds.

  1. Create esbuild plugin to load rest-api-client as CJS (described in the above article)
  2. Bundle with another bundler, Rollup, webpack, etc.
  3. Use require.

In CJS file

Loading rest-api-client from CJS by require

const {KintoneRestAPIClient} = require("@kintone/rest-api-client")

console.info('start')
const client = new KintoneRestAPIClient({
  baseUrl: 'https://hoge.hoge.hoge',
  auth: { apiToken: 'hoge' },
})
console.log('end')

=> Bundled and run successfully

In ESM

Loading rest-api-client from ESM by require

import { createRequire } from "module";
const require = createRequire(import.meta.url);
const {KintoneRestAPIClient} = require("@kintone/rest-api-client")

console.info('start')
const client = new KintoneRestAPIClient({
  baseUrl: 'https://hoge.hoge.hoge',
  auth: { apiToken: 'hoge' },
})
console.log('end')

=> Not bundled but run successfully
(rest-api-client is loaded by require in bundled file)

from js-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.