Coder Social home page Coder Social logo

autifyhq / parcel-reporter-bundle-manifest Goto Github PK

View Code? Open in Web Editor NEW
21.0 5.0 3.0 2.09 MB

https://github.com/mugi-uno/parcel-plugin-bundle-manifest, but for Parcel 2

License: MIT License

TypeScript 96.79% JavaScript 1.74% Shell 1.46%
parcel2 parcel2-plugin bundler-plugin manifest parcel-plugin parcel parcel-bundler hacktoberfest

parcel-reporter-bundle-manifest's Issues

modern / legacy builds and "nomodule" fallback script tag

When using browserslist / browsers directive to add support for old browsers, parcel 2 generates a legacy script tag with nomodule:

Example html file generated by parcel for my legacy target (parcel build):

<!doctype html>
<html lang="nl">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="/index.48ec94f5.css" type="text/css">
</head>
<body>
<script src="/index.1400586f.js" type="module"></script>
<script src="/index.b99f7985.js" nomodule="" defer></script>
</body>
</html>

in parcel-manifest.json, only index.1400586f.js is referenced, but not index.b99f7985.js.

I'd like to have an option where an additional parcel-manifest.legacy.json is generated where only the fallback urls are referenced.

package.json

{
[...]
 "scripts": {
    "build": "parcel build index.html",
  },
"targets": {
    "modern": {
      "engines": {}
    },
    "legacy": {
      "engines": {
        "browsers": "> 0.5%, last 2 versions, not dead, IE 11"
      }
    }
  },
[...]
}

src index.html:

<!doctype html>
<html lang="nl">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="site.scss" type="text/css"/>
</head>
<body>

<script src="site.js" type="module"></script>
</body>
</html>

[ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string.

TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received undefined
    at validateString (internal/validators.js:124:11)
    at Object.relative (path.js:1167:5)
    at Object.report (/usr/src/app/node_modules/parcel-reporter-bundle-manifest/lib/BundleManifestReporter.js:1:577)
    at ReporterRunner.report (/usr/src/app/node_modules/@parcel/core/lib/ReporterRunner.js:105:33)
    at async Parcel._build (/usr/src/app/node_modules/@parcel/core/lib/Parcel.js:449:7)
    at async Parcel._startNextBuild (/usr/src/app/node_modules/@parcel/core/lib/Parcel.js:301:24)
    at async PromiseQueue._runFn (/usr/src/app/node_modules/@parcel/utils/lib/PromiseQueue.js:88:7)
    at async PromiseQueue._next (/usr/src/app/node_modules/@parcel/utils/lib/PromiseQueue.js:75:5) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Just ran an npm update, and parcel doesn't want to build anymore. I flushed .parcel-cache, dist, and node_modules

"parcel": "^2.0.0-rc.0",
"parcel-reporter-bundle-manifest": "^0.3.3"

`parcel build` generates multiple manifest.json when using `package.json#targets`

I found parcel-reporter-bundle-manifest generates multiple manifest files in the project which has multiple entries.

Parcel provides the way to handle one or more entries.
https://parceljs.org/features/targets/

When using package.json#targets I found parcel-reporter-bundle-manifest generates the number of entries in parcel build .
parcel serve generates one manifest file.

$ cat package.json

{
  ...
  "targets": {
    "a": {
      "source": "a.js"
    },
    "b": {
      "source": "b.js"
    }
  },
}

$ yarn run parcel serve
$ cat dist/parcel-manifest.json
{"a.js":"/a.js","b.js":"/b.js"}

$ yarn run parcel build
$ cat dist/a/parcel-manifest.json
{"a.js":"/a.js"}
$ cat dist/b/parcel-manifest.json
{"b.js":"/b.js"}

It is not occured while using package.json#source to give multiple entries to parcel.
It is In My Opinion, but it should be generated one manifest.json file.


Reproduce code↓
https://github.com/mtgto/example-multi-entry-parcel-reporter-bundle-manifest

Add public-dir, host and port to manifest

Hi!

We are serving a Symfony PHP application with Caddy, and Symfony reads this manifest file and serves the correct assets, this works perfectly!

But, in development, I would love to serve the assets directly with parcel on its own port, and not trough Caddy, but parcel-reporter-bundle-manifest doesnt include the schema/host/port when using parcel serve.

This is different than webpack dev-server works, would you accept a PR to include this information?

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.