https://github.com/posva/store-code-split-demo
demo to showcase ideal codesplit for a store like Vuex
https://github.com/posva/store-code-split-demo
Last synced: about 1 month ago
JSON representation
demo to showcase ideal codesplit for a store like Vuex
- Host: GitHub
- URL: https://github.com/posva/store-code-split-demo
- Owner: posva
- Created: 2019-02-27T11:57:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-18T08:25:53.000Z (about 7 years ago)
- Last Synced: 2025-01-05T16:52:53.453Z (over 1 year ago)
- Language: JavaScript
- Size: 57.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Demo for (ideal) code splitting with Vuex
This is a demo repo to showcase that ideally, we could codesplit getters and actions per page (the page would be `src/usingModuleA`).
For it to work, it is necessary to split _actions_ and _getters_ from `index.js` which is imported by `store` into one or multiple files (`actions.js` and `getters.js`)
## Instructions
First try without changing anything
```sh
yarn
yarn build
grep -Rl another dist # dist/1.js
```
The unused function in `actions.js` gets discarded
then comment out the content in `src/index.js` and build again:
```sh
yarn
yarn build
grep -Rl another dist # dist/1.js and dist/2.js
```
Both files 1.js and 2.js include **all actions**
Unfortunately, the same file cannot be code splitted into different bundles. Unused function can be removed though