Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dependencies are not bundled #18

Open
milahu opened this issue Dec 5, 2022 · 0 comments
Open

dependencies are not bundled #18

milahu opened this issue Dec 5, 2022 · 0 comments

Comments

@milahu
Copy link

milahu commented Dec 5, 2022

how can i bundle all dependencies into one file?
(without using dynamic imports)

example: bundle all dependencies of ...

import { EditorView, Decoration, keymap } from "@codemirror/view"
import { StateField, StateEffect } from "@codemirror/state"
import { StreamLanguage } from "@codemirror/language"
import { defaultKeymap, history, historyKeymap } from "@codemirror/commands"

... into dist/codemirror.js

based on my example in #17

import { defineConfig } from "vite"
import { chunkSplitPlugin } from 'vite-plugin-chunk-split'

export default defineConfig({
  plugins: [
    chunkSplitPlugin({
      //strategy: 'default',
      customSplitting: {
        'codemirror': [/\/node_modules\/@codemirror\//],
      }
    })
  ],
})

problem: dependencies of codemirror are not bundled into codemirror.js

for example, style-mod and @lezer/common are in vendor.js

dist/index.js                 11.29 KiB / gzip: 4.36 KiB
dist/vendor.js                187.66 KiB / gzip: 40.72 KiB
dist/codemirror.js            369.08 KiB / gzip: 116.12 KiB
pnpm list --recursive --depth 10

devDependencies:

@codemirror/commands 6.1.2
├─┬ @codemirror/language 6.3.1
│ ├── @codemirror/state 6.1.4
│ ├─┬ @codemirror/view 6.6.0
│ │ ├── @codemirror/state 6.1.4
│ │ ├── style-mod 4.0.0
│ │ └── w3c-keyname 2.2.6
│ ├── @lezer/common 1.0.2
│ ├─┬ @lezer/highlight 1.1.3
│ │ └── @lezer/common 1.0.2
│ ├─┬ @lezer/lr 1.2.5
│ │ └── @lezer/common 1.0.2
│ └── style-mod 4.0.0
├── @codemirror/state 6.1.4
├─┬ @codemirror/view 6.6.0
│ ├── @codemirror/state 6.1.4
│ ├── style-mod 4.0.0
│ └── w3c-keyname 2.2.6
└── @lezer/common 1.0.2

@codemirror/state 6.1.4

@codemirror/view 6.6.0
├── @codemirror/state 6.1.4
├── style-mod 4.0.0
└── w3c-keyname 2.2.6

queue-microtask 1.2.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant