Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The "global" output format is not supported in the "browser" target #7080

Closed
lukejagodzinski opened this issue Oct 14, 2021 · 4 comments
Closed

Comments

@lukejagodzinski
Copy link

lukejagodzinski commented Oct 14, 2021

🐛 bug report

I guess it's related to 2.0.0 release but I've just tried to deploy the same app without changing anything today and it stopped working with the error: @parcel/core: The "global" output format is not supported in the "browser" target.. This format was supported and should be supported for the browser target.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "browser": "./dist/bootstrap.js",
  "targets": {
    "browser": {
      "distDir": "dist",
      "engines": {
        "browsers": "> 0.2%, not dead"
      },
      "includeNodeModules": true,
      "isLibrary": false,
      "outputFormat": "global"
    }
  }
}

🌍 Your Environment

Software Version(s)
Parcel 2.0.0
Node 12.22.1
npm/Yarn Yarn 1.22.10
Operating System MacOS 11.6
@mischnic
Copy link
Member

Please choose a different name than "browser". That one is meant for libraries: https://parceljs.org/features/targets/#library-targets

@lukejagodzinski
Copy link
Author

lukejagodzinski commented Oct 14, 2021

I've done more tests and it looks like the solution could be changing config to something like this:

{
  "targets": {
    "bootstrap": {
      "engines": {
        "browsers": "> 0.2%, not dead"
      },
      "includeNodeModules": true,
      "outputFormat": "global"
    }
  }
}

But then I can't control the name of the output file... It's always index.js file. Sometimes I love Parcel and sometimes I hate it. I didn't change anything and now our entire project doesn't build...

@mischnic
Copy link
Member

Do this:

{
  "bootstrap": "my-dist/output.js"
  "targets": {
    "bootstrap": {
      "engines": {
        "browsers": "> 0.2%, not dead"
      },
      "includeNodeModules": true,
      "outputFormat": "global"
    }
  }
}

@lukejagodzinski
Copy link
Author

It looks like I can still control the name with this:

{
  "bootstrap": "dist/bootstrap.js",
  "targets": {
    "bootstrap": {
      "engines": {
        "browsers": "> 0.2%, not dead"
      },
      "includeNodeModules": true,
      "outputFormat": "global"
    },
    "controller": {}
  }
}

Would be great if docs mention it at all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants