Skip to content

Bundler ignores <noscript> #25618

@EKHH

Description

@EKHH

What version of Bun is running?

1.3.3+274e01c73

What platform is your computer?

Linux 6.17.11-300.fc43.x86_64 x86_64 unknown

What steps can reproduce the bug?

  1. Create an HTML file referencing a local stylesheet inside <noscript>.
  2. Execute the following command:
user@bun:~$ bun build *.html --production --minify --target=browser --outdir ./output/
  1. Turn off JavaScript and find out that Bun’s bundler ignores the stylesheet completely.

What is the expected behavior?

For example, with following files:

<!-- index.html -->
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<noscript><link rel="stylesheet" href="noscript.css" /></noscript>
	</head>
	<body>
		<p>Hello, World!</p>
	</body>
</html>
/* noscript.css */
p {
	color: red;
}

One expects the production of a file that shows Hello, World! in red when JavaScript is off.

What do you see instead?

Black text with error:

... GET file:///.../output/noscript.css net::ERR_FILE_NOT_FOUND
<!-- ./output/index.html -->
<!doctype html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<noscript><link rel="stylesheet" href="noscript.css" /></noscript>
	<script type="module" crossorigin src="./index-y1e0g89h.js"></script></head>
	<body>
		<p>Hello, World!</p>
	</body>
</html>

Additional information

<noscript> represents nothing if scripting is enabled. It is a crucial accessibility feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions