Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-hot-reload-api

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-hot-reload-api

hot reload api for *.vue components

  • 2.3.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is vue-hot-reload-api?

The vue-hot-reload-api package is a library that provides hot-reloading capabilities for Vue.js components. It allows developers to update Vue components in real-time without losing the state of the application, which significantly speeds up the development process.

What are vue-hot-reload-api's main functionalities?

Install and Setup

This code demonstrates how to install and set up the vue-hot-reload-api. It installs the hot-reload API and sets it up to work with Vue. The module.hot.accept() call ensures that the module accepts hot updates.

const hotAPI = require('vue-hot-reload-api');
hotAPI.install(require('vue'));
if (module.hot) {
  module.hot.accept();
}

Create a Hot-Reloadable Component

This code shows how to create a hot-reloadable Vue component. When the MyComponent.vue file is updated, the new component is reloaded without losing the state of the application.

if (module.hot) {
  module.hot.accept('./MyComponent.vue', function () {
    const NewComponent = require('./MyComponent.vue').default;
    hotAPI.reload('my-component-id', NewComponent);
  });
}

Preserve Component State

This code demonstrates how to preserve the state of a Vue component during hot-reloading. By passing the { preserveState: true } option, the state of the component is maintained even after the component is reloaded.

if (module.hot) {
  module.hot.accept('./MyComponent.vue', function () {
    const NewComponent = require('./MyComponent.vue').default;
    hotAPI.reload('my-component-id', NewComponent, { preserveState: true });
  });
}

Other packages similar to vue-hot-reload-api

Keywords

FAQs

Package last updated on 11 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc