Vueify is a Browserify transform specifically designed to enable the use of Vue.js single-file components (SFCs) within build pipelines leveraging Browserify. It supports Vue 2.x syntax for templates, scripts, and styles, including scoped CSS and the integration of various pre-processors like Stylus, Less, Sass, PostCSS, Jade, Pug, and CoffeeScript. The current stable version is 9.4.1, with its last significant feature update (v9.0.0) adding Vue 2.0 support. Given the rapid evolution of the JavaScript ecosystem and the current widespread adoption of Vue 3 and modern bundlers like Webpack or Vite, Vueify is largely considered a maintenance-mode solution for existing projects built around Browserify and Vue 2.x. It differentiates itself by providing a comprehensive component compilation and bundling solution tailored specifically for the Browserify ecosystem, allowing developers to write `.vue` files without needing to switch to other build tools.
npm install vueifyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to programmatically use `vueify` with `browserify` to compile a Vue 2.x single-file component (`app.vue`) into a runnable JavaScript bundle (`bundle.js`) from a main entry file (`main.js`). It includes the creation of a minimal `app.vue` and `main.js` for a self-contained example, followed by the Browserify bundling process and instructions for integrating it into an HTML page.
Ensure your project uses Vue.js 2.x (e.g., `npm install vue@2 --save-dev`). For Vue 1.x, use Vueify 8.x (`npm install vueify@8 --save-dev`). For Vue 3.x, use modern build tools like Vite or Webpack with `vue-loader`.
Prefix your build command with `NODE_ENV=production` (e.g., `cross-env NODE_ENV=production browserify ...` or platform-specific equivalent) for production builds.
Define functional components as separate `.js` files and import them using `require()`, or consider restructuring your components to avoid functional components directly within `*.vue` files when using Vueify.
For new projects or migrating existing ones to Vue 3, strongly consider using modern build tools such as Vite (recommended for Vue 3 projects) or Webpack with `vue-loader`.
Run `npm install vue@2 --save-dev` to install the correct Vue 2.x version. Ensure `vue` is listed in your `package.json` dependencies and properly installed in `node_modules`.
Extract the functional component definition into a separate `.js` file and then `require()` it into your `.vue` component's script section, or refactor the component to be a standard stateful component.
Upgrade your project to Vue.js 2.x (e.g., `npm install vue@2 --save-dev`) or downgrade Vueify to a compatible 8.x version (`npm install vueify@8 --save-dev`) if you must remain on Vue 1.x.
Upgrade to vueify v9.4.0 or newer, which contains a fix for this specific deprecation warning. While generally harmless, updating is recommended to remove console noise and ensure future compatibility.