Nonlinear Performance Magnification
Get unlimited public & private packages + team-based management with npm Teams.Learn more »

require-vue-loader

2.1.2 • Public • Published

require-vue-loader

A require hook for loading single-file vue component in Node. support i18next, without babel, webpack

npm i require-vue-loader

fork from require-extension-vue, old README see here

break change

wellcome report bug

  1. remove auto hook
  2. rewrite to typescript
  3. webpack vue-loader like, so u can keep near same code, without change too much
  4. change exports return value, see normalize-component
  5. default support i18next so u can use with vue-i18next2
  6. ...more tell me

demo

see more api at source code

  1. auto register like old way
import loader from 'require-vue-loader/register';
import tsPlugin from 'require-vue-loader/lib/plugin/ts';
 
loader.use(tsPlugin);
import loader from 'require-vue-loader';
import tsPlugin from 'require-vue-loader/lib/plugin/ts';
 
loader.register();
loader.use(tsPlugin);

import testVue from './test/temp/test.vue';
import testVue, { vueComponent, esModule, $options, options } from './test/temp/test.vue';
import loader from 'require-vue-loader';
import tsLoader from 'require-vue-loader/lib/plugin/ts';
 
loader.register();
loader.use(tsLoader);
 
import * as Vue from 'vue/dist/vue';
Vue.config.productionTip = false;
 
import { options } from './temp/test.vue';
 
const vm = new Vue(options).$mount();
 
console.log('= vm.$el.innerHTML =');
 
console.log(vm.$el.innerHTML);
 
console.log('= document.documentElement.innerHTML =');
 
console.log(document.documentElement.innerHTML);
 

plugin

tsPlugin can work on old require-extension-vue too

import * as loader from 'require-extension-vue';
import tsPlugin from 'require-vue-loader/lib/plugin/ts';
 
tsPlugin.register(loader);

Install

npm i require-vue-loader

DownloadsWeekly Downloads

2

Version

2.1.2

License

MIT

Last publish

Collaborators

  • avatar