parcel: Parcel 2: @parcel/transformer-raw problems

๐Ÿ› bug report

https://github.com/Banou26/parcel-bug-4174

When using this configuration as per https://github.com/parcel-bundler/parcel/issues/1080#issuecomment-557240449 and https://github.com/parcel-bundler/parcel/issues/501#issuecomment-557240714 .parcelrc

{
  "extends": "@parcel/config-default",
  "transforms": {
    "url:*": ["@parcel/transformer-raw"]
  }
}

The end build isnโ€™t transpiled at all, for example in the repro, the index.html imports index.ts which contains

import './foo.ts'

console.log('foo')

and the output build Parcel serves is

/parcel-test.d7ebec59.ts

import './foo.ts'

console.log('foo')

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

.parcelrc

{
  "extends": "@parcel/config-default",
  "transforms": {
    "url:*": ["@parcel/transformer-raw"]
  }
}

package.json

{
  "name": "parcel-raw-transform",
  "version": "0.0.1",
  "main": "index.js",
  "license": "MIT",
  "devDependencies": {
    "parcel": "^2.0.0-nightly.116"
  },
  "scripts": {
    "dev": "parcel src/index.html"
  }
}

I tried with both the 2.0.0-alpha.3.2 and 2.0.0-nightly.116

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Iโ€™ve tried again using this config

{
  "name": "parcel-raw-transform",
  "version": "0.0.1",
  "license": "MIT",
  "devDependencies": {
    "parcel": "^2.0.0-nightly.116"
  },
  "scripts": {
    "dev": "parcel src/index.html --target=appModern"
  },
  "appModern": "dist/browserModern/index.html",
  "targets": {
    "appModern": {
      "engines": {
        "browsers": ["last 1 chrome version"]
      }
    }
  }
}

the build in /dist/browserModern still only contains

import './foo.ts'

console.log('foo')

and now in addition, even though the logs says Server running at http://localhost:1234 iโ€™m getting

Request URL: http://localhost:1234/
Request Method: GET
Status Code: 403 Forbidden

If i remove --target=appModern, then the serving server responds correctly, but iโ€™m still getting the same original problem, which is having this error

- Refused to execute script from 'http://localhost:1234/parcel-test.d7ebec59.ts' because its MIME type ('video/mp2t') is not executable.

because the served html file points to a .ts file which is not transpiled /parcel-test.d7ebec59.ts

import './foo.ts'

console.log('foo')