question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

i use vue2-sfc-loader ,vsersion 0.8.3 ,hava one erro

See original GitHub issue

vue version : v2.6.14 vue2-sfc-loader version : 0.8.3 error:

Uncaught (in promise) TypeError: t is not a function
    at vue2-sfc-loader.js:65
    at vue2-sfc-loader.js:65
    at async P (vue2-sfc-loader.js:65)
    at async Module.N (vue2-sfc-loader.js:65)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
FranckFreiburgercommented, Jul 7, 2021

Before vue3-sfc-loader v1.0.0, API may change quickly. At each release, try to take a look at https://github.com/FranckFreiburger/vue3-sfc-loader/blob/main/CHANGELOG.md

In your case, you are using the old API :

getFile() : see https://github.com/FranckFreiburger/vue3-sfc-loader/blob/main/CHANGELOG.md#080-2021-05-31 handleModule is now a function, see https://github.com/FranckFreiburger/vue3-sfc-loader/blob/main/CHANGELOG.md#060-2021-03-20

0reactions
fushengruomengzhangcommented, Jul 7, 2021

I am getting the same error from Vue3-sfc-loader. This is going directly from 0.7.3 to 0.8.3. (Only difference in my code being the import of 0.8.3) Any recommendations? Error:

Uncaught (in promise) TypeError: t is not a function
    at vue3-sfc-loader-083.js:69

Sorry, I have an error using 0.8.3, so I am currently using 0.7.3

I have modified the option. Please refer to it.

const options = {
    moduleCache: {vue: Vue},
    getFile(url) {
        url = /.*?\.js|.mjs|.css|.less|.vue$/.test(url) ? url : `${url}.vue`
        const type = /.*?\.js|.mjs$/.test(url) ? ".mjs" : /.*?\.vue$/.test(url) ? '.vue' : /.*?\.css$/.test(url) ? '.css' : '.vue';
        const getContentData = asBinary => fetch(url).then(res => !res.ok ? Promise.reject(res) : asBinary ? res.arrayBuffer() : res.text())
        return {getContentData: getContentData, type: type}
    },
    addStyle(textContent, url) {
        if (url) {
            let linkElement = document.createElement('link');
            linkElement.setAttribute('rel', 'stylesheet')
            linkElement.setAttribute('type', 'text/css')
            linkElement.setAttribute('href', url)
            document.head.insertBefore(linkElement,
                document.head.getElementsByTagName('style')[0] || null)
        } else if (textContent) {
            let styleElement = document.createElement('style');
            document.head.insertBefore(Object.assign(styleElement, {textContent}),
                document.head.getElementsByTagName('style')[0] || null);
        }
        return null;
    },
    handleModule(type, getContentData, path, options) {
        switch (type) {
            case '.css':
                return options.addStyle(getContentData(false), path);
            case '.less':
                console.error('.......')
        }
    },
    log(type, ...args) {
        console.log(type, ...args);
    }
};
Read more comments on GitHub >

github_iconTop Results From Across the Web

vue-loader install wrong version · Issue #6838 · vuejs/vue-cli
Version 5.0.0-rc.1 Steps to reproduce I need install the following vue-loader but cause error: "devDependencies": { "vue-loader": "15.9.8", } ...
Read more >
Error : vue-loader requires @vue/compiler-sfc to be present in ...
Looks like you are trying to use vue-loader from Vue 3 in Vue 2 project. Here is a versions I have for Vue...
Read more >
Getting Started - Vue Loader
Follow this guide if the built-in configuration of Vue CLI does not suit your needs, or you'd rather create your own webpack config...
Read more >
How to easily use Vue 3.x with ICP, step by step guide
I've just used a simple folder structure here, separating generic Vue components into components directory, pages into pages etc.
Read more >
vue-loader - npm
Vue single -file component loader for Webpack. Latest version: 17.0.1, last published: 2 months ago. Start using vue-loader in your project ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found