require-vue-loader
v2.1.2
Published
A require hook for loading single-file vue component in Node. support i18next, without babel, webpack
Downloads
3
Maintainers
Readme
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
- remove auto hook
- rewrite to typescript
- webpack
vue-loader
like, so u can keep near same code, without change too much - change
exports
return value, see normalize-component - default support i18next so u can use with vue-i18next2
- ...more tell me
demo
see more api at source code
- 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);