With the latest version of nuxt, plugins go to the right build via their filename when they are referenced in nuxt.config.js
plugin.server.js > goes to server bundle
plugin.client.js > goes to client bundle
plugin.js > goes to both
This functionality doesn't seem to work when adding plugins via modules using .addPlugin
This forces people to do .addPlugin( src:'...', mode:'something') when I'd expect the 'default' mode to be based off the source filename
https://nuxtjs.org/api/internals-module-container#addplugin-template-
@hecktarzuli thanks for this note. Yes, that would be more consistent. PR welcome. However, if we support this feature in a nuxt minor release, your module is only compatible with this version upwards and unsafe to use on older versions.
BTW are you sure omitting mode does not triggers auto mode detection? addPlugin adds to the same array and it will be processed here: https://github.com/nuxt/nuxt.js/blob/dev/packages/builder/src/builder.js#L272
Reproduce: https://github.com/pi0/nuxt-module-plugin-mode
Plugin is only included in client side.
Yes, I tried it first omitting mode, assuming it worked as expected. Then I inspected ./nuxt/index.js and saw the plugin comment said 'all'.
After passing mode, it changed to whatever i passed


@hecktarzuli Right. I got the issue. It is because without providing fileName the generated name will be like mode-test.plugin.client.530b6c6a.js and regex fails to detect extension. Will open a PR for fix.
@pi0 as Whitney Houston once said, "did you ever know that you are my hero?"
Most helpful comment
@hecktarzuli Right. I got the issue. It is because without providing
fileNamethe generated name will be likemode-test.plugin.client.530b6c6a.jsand regex fails to detect extension. Will open a PR for fix.