Giter Site home page Giter Site logo

tsup-preset-solid's People

Contributors

biswaviraj avatar gazatu avatar lachlancollins avatar thetarnav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

gazatu biswaviraj

tsup-preset-solid's Issues

NotFoundError: Failed to execute 'insertBefore' on 'Node': The node before which the new node is to be inserted is not a child of this node

Error with a library built using tsup-preset-solid

When using the library error occurs
If copy the library source code into project the error goes away
The error only occurs if something that is stateful is on top

Here's a reproducer
https://github.com/Qawaz/solid-start-issue

Library is built using tsup-preset-solid, You can consider that library only contains one file baseStyled which I've already included in the project If you make a package of that file the error occurs

I don't know where to report this, If this is not an issue with tsup-preset-solid and is an issue with something this preset relies on (esbuild-plugin-solid), I could report it further !

JSX files present in dist

When I build the tsx files get built and they become jsx files into dist folder which then cause errors like this on build where library is consumed

I am trying to build a solid-start project which consumes a library that is published using this preset with tsup, That library contains jsx

The library is @qinetik/anique-icons, only contains 4 icons at the moment

Error [RollupError]: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at error (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:2287:30)
    at Module.error (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:13745:16)
    at Module.tryParse (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:14476:25)
    at Module.setSource (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:14077:39)
    at ModuleLoader.addModuleSource (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:24649:20) {
  cause: SyntaxError: Unexpected token (3:9)
      at pp$4.raise (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:21621:13)
      at pp$9.unexpected (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:18829:8)
      at pp$5.parseExprAtomDefault (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20990:8)
      at pp$5.parseExprAtom (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20985:17)
      at pp$5.parseExprSubscripts (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20769:19)
      at pp$5.parseMaybeUnary (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20735:17)
      at pp$5.parseExprOps (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20662:19)
      at pp$5.parseMaybeConditional (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20645:19)
      at pp$5.parseMaybeAssign (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20612:19)
      at pp$5.parseExpression (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:20575:19)
      at pp$8.parseReturnStatement (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:19149:31)
      at pp$8.parseStatement (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:18977:37)
      at pp$8.parseBlock (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:19311:21)
      at pp$5.parseFunctionBody (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:21440:22)
      at pp$8.parseFunction (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:19433:8)
      at pp$8.parseFunctionStatement (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:19127:15)
      at pp$8.parseStatement (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:18972:17)
      at pp$8.parseTopLevel (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:18886:21)
      at Parser.parse (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:18658:15)
      at Function.parse (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:18708:35)
      at Graph.contextParse (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:25754:38)
      at Module.tryParse (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:14473:31)
      at Module.setSource (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:14077:39)
      at ModuleLoader.addModuleSource (file:///D:/Programming/Web/Libraries/solid-account-management/node_modules/rollup/dist/es/shared/node-entry.js:24649:20) {
    pos: 53,
    loc: Position { line: 3, column: 9 },
    raisedAt: 54
  },
  code: 'PARSE_ERROR',
  id: 'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@qinetik\\anique-icons\\dist\\server.jsx',
  pos: 53,
  loc: {
    column: 9,
    file: 'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@qinetik\\anique-icons\\dist\\server.jsx',
    line: 3
  },
  frame: '1: // src/AlertIcon.tsx\n' +
    '2: function AlertIcon() {\n' +
    '3:   return <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">\n' +
    '            ^\n' +
    '4:     <title>alert</title>\n' +
    '5:     <path d="M13 14H11V9H13M13 18H11V16H13M1 21H23L12 2L1 21Z" />',
  watchFiles: [
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\demo\\.solid\\server\\server.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\demo\\dist\\public\\route-manifest.json',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\demo\\.solid\\server\\entry-server.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\solid-start\\node\\globals.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\solid-start\\node\\fetch.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\solid-js\\dist\\server.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\typescript-cookie\\dist\\typescript-cookie.mjs',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\solid-js\\web\\dist\\server.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@qinetik\\anique\\dist\\server.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@qinetik\\emotion\\dist\\server.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\seroval\\dist\\esm\\production\\index.mjs',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@qinetik\\anique-icons\\dist\\server.jsx',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@emotion\\serialize\\dist\\emotion-serialize.esm.js',
    'D:\\Programming\\Web\\Libraries\\solid-account-management\\node_modules\\@emotion\\is-prop-valid\\dist\\emotion-is-prop-valid.esm.js'
  ]
}

Node.js v20.7.0

Shouldn't this preset use babel to transform the JSX files

Add a way to disable certain targets

Hi, ๐Ÿ‘‹

thanks for making this preset. It makes writing SolidJS libs a lot easier. Especially with the automatically generated exports object, which can get quite complicated.

In terms of complexity, the generated conditions for the entrypoint file look like this.

    "./server": {
      "worker": {
        "solid": "./dist/server/server.jsx",
        "import": {
          "types": "./dist/server/index.d.ts",
          "default": "./dist/server/server.js"
        },
        "require": "./dist/server/server.cjs"
      },
      "browser": {
        "solid": {
          "development": "./dist/server/dev.jsx",
          "import": "./dist/server/index.jsx"
        },
        "development": {
          "import": {
            "types": "./dist/server/index.d.ts",
            "default": "./dist/server/dev.js"
          },
          "require": "./dist/server/dev.cjs"
        },
        "import": {
          "types": "./dist/server/index.d.ts",
          "default": "./dist/server/index.js"
        },
        "require": "./dist/server/index.cjs"
      },
      "deno": {
        "solid": "./dist/server/server.jsx",
        "import": {
          "types": "./dist/server/index.d.ts",
          "default": "./dist/server/server.js"
        },
        "require": "./dist/server/server.cjs"
      },
      "node": {
        "solid": "./dist/server/server.jsx",
        "import": {
          "types": "./dist/server/index.d.ts",
          "default": "./dist/server/server.js"
        },
        "require": "./dist/server/server.cjs"
      },
      "solid": {
        "development": "./dist/server/dev.jsx",
        "import": "./dist/server/index.jsx"
      },
      "development": {
        "import": {
          "types": "./dist/server/index.d.ts",
          "default": "./dist/server/dev.js"
        },
        "require": "./dist/server/dev.cjs"
      },
      "import": {
        "types": "./dist/server/index.d.ts",
        "default": "./dist/server/index.js"
      },
      "require": "./dist/server/index.cjs"
    },

This is quite hard to process when reading. There are a lot of conditions for browser, worker, deno etc which all don't apply to our use case because we only use node. We could remove them manually to make the exports field easier to read, but that has two drawbacks.

  1. It won't work with writePackageJson since it will get overriden on every build
  2. It makes the output of printInstructions less copy-pasteable.

So I was thinking it would be great if there was an option to supress the generation of unwanted targets. Is this something that could be considered as an additional feature?

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.