Skip to content
This repository has been archived by the owner on Jan 18, 2022. It is now read-only.

Version 4.1.3 cannot run #198

Closed
easonyq opened this issue May 14, 2018 · 6 comments
Closed

Version 4.1.3 cannot run #198

easonyq opened this issue May 14, 2018 · 6 comments

Comments

@easonyq
Copy link

easonyq commented May 14, 2018

Expected behavior

The latest version (4.1.3) can run normally

Actual behavior

There are two problems:

  1. I wrote this last Friday (version 4.1.0) and succeeded.

    const vue = require('rollup-plugin-vue')

    When I updated this morning (version 4.1.3), it threw an exception: vue is not a function

    After looking up the dist codes, I found that we should modify it to

    const vue = require('rollup-plugin-vue').default
  2. After doing above, there is still a problem remained:

    [!] (vue.delegate plugin) TypeError: Cannot read property 'stringify' of undefined
    src\page\vue-components\AppShell.vue
    TypeError: Cannot read property 'stringify' of undefined
        at Object.exports.createVuePartRequest (D:\mip-project\mip\node_modules\[email protected]
    @rollup-plugin-vue\dist\utils.js:41:72)
        at ...
    

    createVuePartRequest from dist/util.js, contains

    return `${path.basename(filename)}.${lang}?${querystring_1.default.stringify(query)}`;

    where querystring_1 equals to require('querystring').

    The key point is that querystring package uses CommonJs, not ES6 module. Below is node_modules/querystring/index.js:

    exports.decode = exports.parse = require('./decode');
    exports.encode = exports.stringify = require('./encode');

    I don't know whether this is a source code bug or a build problem.

Steps to reproduce the behavior

Just use rollup-plugin-vue with empty config.

const vue = require('rollup-plugin-vue').default;

module.exports = {
    ...
    plugins: [
        ...
        vue()
    ]
}
...
@jonataswalker
Copy link

@znck Doesn't we have a test to catch this kind of error?

@Mourdraug
Copy link

It looks like build error. Transpiler seems to mistake querystring for ES6 module and add .default before function calls.

@funkybob
Copy link

funkybob commented May 14, 2018

I've just hit this same bug. 4.1.0 works fine, 4.1.1+ all fail this way.

(2): src/App.vue
[!] (vue.delegate plugin) TypeError: Cannot read property 'stringify' of undefined
src/App.vue
TypeError: Cannot read property 'stringify' of undefined
    at Object.exports.createVuePartRequest (/home/curtis/src/git/tb/fe-rollup/node_modules/rollup-plugin-vue/dist/utils.js:41:72)
    at Object.<anonymous> (/home/curtis/src/git/tb/fe-rollup/node_modules/rollup-plugin-vue/dist/index.js:90:38)
    at Generator.next (<anonymous>)
    at /home/curtis/src/git/tb/fe-rollup/node_modules/rollup-plugin-vue/dist/index.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/home/curtis/src/git/tb/fe-rollup/node_modules/rollup-plugin-vue/dist/index.js:3:12)
    at Object.transform (/home/curtis/src/git/tb/fe-rollup/node_modules/rollup-plugin-vue/dist/index.js:61:20)
    at /home/curtis/src/git/tb/fe-rollup/node_modules/rollup/dist/rollup.js:17316:48
    at <anonymous>

@Mourdraug
Copy link

Mourdraug commented May 15, 2018

Unfortunately 4.1.0 seems broken on Windows (at least for me) due to #187. If someone needs a quick fix until this is resolved, open node_modules/rollup-plugin-vue/utils.js, replace all querystring_1.default. with querystring_1. and save.

@easonyq
Copy link
Author

easonyq commented May 15, 2018

@Mourdraug Actually I also encounter bugs on Windows and found #187. So I was glad after finding updated version (4.1.3) this week. But...

@znck
Copy link
Member

znck commented May 15, 2018

@jonataswalker It should be caught in tests. Runtime transpilation of ts-jest is different from tsc. Looking into it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants