rollup / rollup/rollup

support comment syntax for dynamic import chunkFileName

Open
#3,314 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
26.3k
Forks
1.8k
Avg merge
2d 11h
Merged PRs (30d)
20

Description

rollup is cool ! what i expected is to support comment syntax for dynamic import chunkFileName.

in webpack, we can write like import (/* myChunkFileName */ () => import('../../index.js'))

Feature Use Case

sometimes in project, need to organize all dynamic import to a configuration as blow

[
  {
     render: () => import("../../aaa/")
  },
  {
     render: () => import("../../bbb/")
  },
  {
     render: () => import("../../ccc/")
  },
]

output.chunkFileNames cannot work as expected cus chunks are all called 'index.js' (aaa/index.js bbb/index.js ...) , so output will something like index0 index1 index2 ...

Feature Proposal

is there any way to support comment syntax dynamic chunkFileNames or
any ideas to make it work based on current api ? it seems manualChunks cannot get the path parameter passed to dynamic import function

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Rollup's dynamic import handling and the output.chunkFileNames and manualChunks APIs described in the issue. Compare the requested comment syntax with the shown import examples and determine a supported design. Done means dynamic imports can express distinct chunk names without relying on index0, index1 naming.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rollup
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.