nuxt-community / vuetify-module

Vuetify Module for Nuxt 2
Other
628 stars 106 forks source link

Programmatical nuxt build (in testing) #337

Open VRuzhentsov opened 4 years ago

VRuzhentsov commented 4 years ago

Module version 1.11.2

Describe the bug

ERROR in ./layouts/default.vue?vue&type=style&index=0&lang=scss& (./node_modules/css-loader/dist/cjs.js??ref--7-oneOf-1-1!./node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loader/src??ref--7-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--7-oneOf-1-3!./node_modules/vue-loader/lib??vue-loader-options!./layouts/default.vue?vue&type=style&index=0&lang=scss&)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
TypeError: t1.get$fiber(...).call$1 is not a function

To Reproduce clear node_modules yarn remove sass node-sass fibers sass-loader run build programmatically

 test("Should load application with main config without faults (takes 60s+)", async() => {
    let config = {};
    const rootDir = resolve(__dirname, "../../..");
    try { config = require(resolve(rootDir, "nuxt.config.js")); } catch (e) {}
    config.rootDir = rootDir;
    config.dev = false;

    const nuxt = new Nuxt(config);

    await new Builder(nuxt).build();

    await nuxt.listen(process.env.PORT || 3001, "localhost");

    const context = {};
    const { html } = await nuxt.renderRoute("/login", context);

    const { window } = new JSDOM(html).window;
    const formElement = window.document.querySelector("v-form#login-form");
    const buttonElement = window.document.querySelector("v-btn[form=login-form]");

    expect(formElement).not.toBeNull();
    expect(buttonElement).not.toBeNull();
    expect(buttonElement.textContent).toBe("Login");

    await nuxt.close();
  }, 300000);

Expected behavior Test passing

Additional context I came to a new step, when I 100% need to override custom variables. Previously my repo contained sass-loader@7 & fibers@4 and it builds perfectly & test passed but tree shaking was not working. now I removed that hard dependencies, so nuxt/vuetify ones used instead. And now tree shaking is working, that is very cool. But, can you tell me please, how to punch that test, so it can start to build app programmatically, and catch that fibers finally?

It seems to me, but somewhere I saw that shaking is turned on only when NODE_ENV=production. Maybe it is worth changing to values from nuxt.config.dev?

jameswomack commented 3 years ago

Did you find a solution?