Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ditdot-dev/vue-code-splitting

Example of code splitting in Vue app with webpack and dynamic imports
https://github.com/ditdot-dev/vue-code-splitting

code-splitting dynamic-import example performance-optimization vue webpack

Last synced: 4 days ago
JSON representation

Example of code splitting in Vue app with webpack and dynamic imports

Awesome Lists containing this project

README

        

# Code Splitting in Vue
> Code splitting example app that demonstrates creating multiple code bundles with dynamic import statements.

Example of code splitting in Vue based on computed property and dynamic components. The initial load contains the initial view and critical assets, while other modules are loaded on the button press.

## Features

- when the data changes, the computed property will re-evaluate
- dynamic component switches between the imported components after the computed property change
- default Vue CLI prefetch function is disabled in vue.config.js - components are loaded on demand, as the user navigates the application

## Article

- [Code Splitting in Vue](https://www.ditdot.hr/en/code-splitting-in-vue-js)

## Clone

Clone this repo to your local machine

```shell
$ git clone https://github.com/ditdot-dev/vue-code-splitting.git
```

## Project setup
```
npm install
```

### Compiles and hot-reloads for development
```
npm run serve
```

### Compiles and minifies for production
```
npm run build
```

### Lints and fixes files
```
npm run lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

## License

[MIT](https://github.com/ditdot-dev/vue-code-splitting-example/blob/main/LICENSE) license.