GithubHelp home page GithubHelp logo

Comments (13)

milesj avatar milesj commented on June 8, 2024 1

@kaleidawave Wait, so this input:

{
    "inputs": {
      "index": "src/node.ts"
    },
    "format": "cjs",
    "platform": "node"
  },

Is writing to cjs/node.cjs and not cjs/index.cjs? That seems like a bug.

Also, src is included in files because they are required for source maps.

from packemon.

milesj avatar milesj commented on June 8, 2024 1

Ok, now fixed!

from packemon.

milesj avatar milesj commented on June 8, 2024

@kaleidawave That's odd, what's your config? It sets main based on your chosen formats.

The files is intentional. It's so you don't have to manage npmignore yourself and only the files that should be packed will be in the tar file.

from packemon.

kaleidawave avatar kaleidawave commented on June 8, 2024

Yep, I have no idea, it doesn't mention ./cjs/index.cjs in the config:

"packemon": [
  {
    "inputs": {
      "index": "src/node.ts"
    },
    "format": "cjs",
    "platform": "node"
  },
  {
    "inputs": {
      "bin": "src/cli.ts"
    },
    "platform": "node"
  },
  {
    "inputs": {
      "web": "src/web.ts"
    },
    "platform": "browser",
    "support": "current"
  },
  {
    "inputs": {
      "import": "src/web.ts"
    },
    "platform": "node",
    "format": "mjs",
    "support": "current"
  }
]

Does packemon read any other inputs..?

On adding specifically the src to the files section: I am not sure it should be added as none of the files in src are used in the export or main fields.

The rest of packemon is excellent but at the moment I'm having to modify these two lines between builds.

from packemon.

kaleidawave avatar kaleidawave commented on June 8, 2024

Yep, from that input the transpiled contents of (the entrypoint) src/node.ts end up in cjs/node.cjs. I think that is the desired output as forcing it to cjs/index.cjs could mess up direct imports pointing to cjs/node.cjs. I don't think there is any need for it to be specifically named index. Just as long as the main field points to the correct file.

from packemon.

milesj avatar milesj commented on June 8, 2024

@kaleidawave So the left-hand side of the inputs object should be the filename, hence index.

I'll give this exact configuration a test and see what's up.

from packemon.

milesj avatar milesj commented on June 8, 2024

@kaleidawave So I have quick test case here and given your config, it's generating the correct package.json to me. #43

Do you have a branch or something I can check out?

from packemon.

milesj avatar milesj commented on June 8, 2024

@kaleidawave Bumping this ^^^

from packemon.

kaleidawave avatar kaleidawave commented on June 8, 2024

https://replit.com/@kaleidawave/packemon-package-main-issue

With the following inputs with the entrypoint src/my-entrypoint.ts:

"packemon": [
  {
    "inputs": {
      "index": "src/my-entrypoint.ts"
    },
    "format": "cjs",
    "platform": "node"
  }
],

Packemon builds to cjs/my-entrypoint.cjs and dts/my-entrypoint.d.ts but sets the main and types fields in package.json to the non-existant cjs/index.cjs and dts/index.d.ts. I am not quite sure if this is a issue with the location it writes to or a issue with the data it writes to package.json

In the project I am currently using packemon in, I currently correct it in postbuild so I don't need this fix urgently.

from packemon.

milesj avatar milesj commented on June 8, 2024

@kaleidawave Is this still happening on the latest version? I think it may be related to not bundling, but will have to verify.

from packemon.

kaleidawave avatar kaleidawave commented on June 8, 2024

Hi, updated the repl to 0.16.3 and the "main" field now correctly points to the correct entry file so that is fixed, thanks! 😃. However the "types" field which points to the type declarations is still pointing to dts/index.d.ts rather than dts/my-entrypoint.d.ts.

from packemon.

milesj avatar milesj commented on June 8, 2024

@kaleidawave Haha damn. Should be an easy fix now that I know what's happening.

from packemon.

kaleidawave avatar kaleidawave commented on June 8, 2024

Yep, just checked and types field is correct now! Thanks 😁

from packemon.

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.