Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DruxtSiteMixin can not be used in clientside #545

Open
1 task
Tracked by #572
Decipher opened this issue Aug 5, 2022 · 2 comments
Open
1 task
Tracked by #572

DruxtSiteMixin can not be used in clientside #545

Decipher opened this issue Aug 5, 2022 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@Decipher
Copy link
Member

Decipher commented Aug 5, 2022

Describe the bug
It appears that when using the DruxtSiteMixin you get an error in clientside due to fs.

 ERROR  Failed to compile with 1 errors

This dependency was not found:

* fs in ./node_modules/druxt-site/dist/druxt-site.esm.js

To install it, you can run: npm install --save fs
ℹ Waiting for file changes
ℹ Memory usage: 177 MB (RSS: 273 MB)
ℹ Listening on: http://localhost:3000/

To Reproduce
Steps to reproduce the behavior:

  1. https://gitpod.io/#https://github.com/druxt/druxt.js
  2. Add following to examples/druxt-site/components/druxt/site/Default.vue:
    <template>
      <div>
        <slot name="header" />
        <slot name="content" />
        <slot name="footer" />
      </div>
    </template>
    
    <script>
    import { DruxtSiteMixin } from 'druxt-site'
    export default {
      mixins: [DruxtSiteMixin]
    }
    </script>
    
  3. Run storybook: cd examples/druxt-site && yarn && yarn storybook
  4. Open site story: /?path=/docs/druxt-site-druxtsite--wrapper

Expected behavior

  • DruxtSiteMixin shouldn't require fs

Media
N/A

Your Environment (please complete the following information):
N/A

Additional context
N/A

@Decipher Decipher added the bug Something isn't working label Aug 5, 2022
@Decipher Decipher added this to the 1.0.0 milestone Aug 7, 2022
@Decipher
Copy link
Member Author

Decipher commented Aug 7, 2022

This issue is related to the DruxtSite Nuxt module requiring fs, and both the module and mixin sharing the same bundle.

Ideally two actions could and should be taken:

  1. Move the Nuxt module into it's own bundle, like the DruxtRouter module, meaning it will be installed as druxt-site/nuxt
  2. Remove Mixins from the bundle, meaning they'll be required to used like import DruxtSiteMixin from 'druxt-site/dist/mixins
    • Maybe do this after 1.0.0

@Sebastix
Copy link
Contributor

Sebastix commented Mar 1, 2023

Ran into the same error today. I removed this snippet from the script element in examples/druxt-site/components/druxt/site/Default.vue as workaround:

import { DruxtSiteMixin } from 'druxt-site'
export default {
  mixins: [DruxtSiteMixin]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants