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

feat: mode for plugin #4592

Merged
merged 7 commits into from Dec 20, 2018
Merged

feat: mode for plugin #4592

merged 7 commits into from Dec 20, 2018

Conversation

clarkdo
Copy link
Member

@clarkdo clarkdo commented Dec 19, 2018

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

The idea is from @Atinux , use .server.js or .client.js to automatically detect server/client side plugin.

  1. introduce mode: 'client|server' in plugin options
  2. deprecate ssr in plugin options and use mode: 'client|server' instead, for now auto adapt ssr: false to mode: 'client' and show deprecating log.
  3. apply server/client plugin on file ext like: server.js or client.js (specified options has higher priority)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@clarkdo clarkdo requested review from pi0 and Atinux December 19, 2018 22:16
@codecov-io
Copy link

codecov-io commented Dec 19, 2018

Codecov Report

Merging #4592 into dev will increase coverage by 0.04%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #4592      +/-   ##
==========================================
+ Coverage   91.02%   91.07%   +0.04%     
==========================================
  Files          61       61              
  Lines        2196     2208      +12     
  Branches      527      533       +6     
==========================================
+ Hits         1999     2011      +12     
+ Misses        179      178       -1     
- Partials       18       19       +1
Impacted Files Coverage Δ
packages/core/src/module.js 100% <ø> (ø) ⬆️
packages/builder/src/builder.js 96.7% <100%> (+0.23%) ⬆️
packages/webpack/src/builder.js 93.68% <66.66%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3fd059d...2ade565. Read the comment docs.

@clarkdo clarkdo requested a review from pi0 December 19, 2018 22:35
@clarkdo clarkdo requested a review from pi0 December 19, 2018 22:49
@pi0 pi0 merged commit e71c455 into nuxt:dev Dec 20, 2018
@clarkdo
Copy link
Member Author

clarkdo commented Dec 20, 2018

Will add a pr for doc

@Atinux
Copy link
Member

Atinux commented Dec 20, 2018

This is awesome @clarkdo

@curtisbelt
Copy link

curtisbelt commented Dec 30, 2018

@clarkdo Hello, I am using nuxt-edge while project is in development, and after updating to a more recent commit, none of my plugins load when using nuxt start, but they work fine when using nuxt dev.

I did some trial and error, moving backwards through available nuxt-edge versions, and determined that the problem starts after this feature was merged. The issue still exists as of 2.4.0-25768669.8786ff73 (8786ff7).

I did not create a reduced test since I am curious if you will simply reproduce bug right away when using nuxt start. If you are unable to reproduce, I am happy to do more research. Thank you!

@clarkdo
Copy link
Member Author

clarkdo commented Dec 30, 2018

@curtisbelt I’ll look into it, thank you for the reporting 🙏

@clarkdo
Copy link
Member Author

clarkdo commented Dec 30, 2018

Hi @curtisbelt Is your plugin specified ssr:false or the file extension is.client/server.js ? If yes, it won’t be loaded in server side

@manniL
Copy link
Member

manniL commented Dec 30, 2018

@clarkdo I experience the same on latest nuxt edge for https://github.com/Developmint/developmint.de

@pi0
Copy link
Member

pi0 commented Dec 30, 2018

I'm wondering how the tests are passing. It may be a breaking change for some special usage. @manniL @curtisbelt could you please help to reproduce it?

@manniL
Copy link
Member

manniL commented Dec 30, 2018

@clarkdo You need modern: 'server' set to trigger the wrong behavior.

nuxt.config.js

module.exports = {
  modern: 'server',
  plugins: [
    { src: '~/plugins/test', ssr: false }
  ]
}

plugins/test.js

window.test = true
console.log('TRIGGERED')

I can confirm that it works before #4592 (latest working version: nuxt-edge@2.4.0-25754270.4fb220c9)

@manniL
Copy link
Member

manniL commented Dec 30, 2018

Update: fix @ #4659

@clarkdo clarkdo deleted the feat/plugin-mode branch April 2, 2019 13:20
@danielroe danielroe added the 2.x label Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants