Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Issues
  • #10977
Closed
Open
Issue created May 17, 2021 by Administrator@rootContributor

react-dev-utils: InlineChunkHtmlPlugin doesn't include other script attributes

Created by: muskuloes

Describe the bug

InlineChunkHtmlPlugin removes all attributes from script tags created by the HtmlWebpackPlugin, including type="module" and defer="defer" which are sometimes necessary. This can be seen here: https://github.com/facebook/create-react-app/blob/7bdeced8495370b683c08b86bc84b66af83f2f0a/packages/react-dev-utils/InlineChunkHtmlPlugin.js#L30

I am using this plugin with a vuejs app. I haven't tried with a react app. The issue can be fixed by updating the plugin. See pull request.

Did you try recovering your dependencies?

yarn --version
1.22.5

Which terms did you search for in User Guide?

https://www.npmjs.com/package/react-dev-utils, InlineChunkHtmlPlugin

Environment

Environment Info:

  current version of create-react-app: 4.0.1
  running from /home/xxx/.config/yarn/global/node_modules/create-react-app

  System:
    OS: Linux 5.4 Linux Mint 20.1 (Ulyssa)
    CPU: (4) x64 Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
  Binaries:
    Node: 12.22.1 - /usr/bin/node
    Yarn: 1.22.5 - /usr/bin/yarn
    npm: 6.14.12 - /usr/bin/npm
  Browsers:
    Chrome: 90.0.4430.93
    Firefox: 88.0
  npmPackages:
    react:  17.0.2 (16.14.0)
    react-dom:  17.0.2 (16.14.0)
    react-scripts:  4.0.3
  npmGlobalPackages:
    create-react-app: Not Found

Steps to reproduce

From the repoducible example:

  1. yarn install
  2. yarn build
  3. open the html file in the browser, (you'd see a blank page => that's the issue)
  4. open the html file in a text editor and manually add the type="module" attribute to the inlined script)
  5. open the html file in the browser once more (this time you'd see the page's content).

I'll add a pull request that fixes the issue for review.

Expected behavior

<script type="module">...</script>

Actual behavior

<script>...</script>

Reproducible demo

https://github.com/muskuloes/inlinechunk-issue-reproducible

Assignee
Assign to
Time tracking