storybook
storybook copied to clipboard
nuxt-bridge fails due to nullish coalescing in h3
Version
@nuxtjs/storybook: latest nuxt: latest bridge
Reproduction Link
https://codesandbox.io/s/github/nuxt-community/storybook/tree/master/examples/bridge (the default for the nuxt bridge support)
Steps to reproduce
Start reproduction.
What is Expected?
No error.
What is actually happening?
Fails with
ERROR in ./node_modules/h3/dist/index.cjs 201:41
Module parse failed: Unexpected token (201:41)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| return input;
| }
> const err = new H3Error(input.message ?? input.statusMessage);
| if (input.statusCode) {
| err.statusCode = input.statusCode;
@ ./node_modules/@nuxt/bridge/dist/runtime/composables.mjs 24:0-34
@ ./node_modules/@nuxt/bridge/dist/runtime/index.mjs
@ ./node_modules/@nuxt/bridge/dist/runtime/capi.plugin.mjs
This can be temporarily fixed with the following in nuxt.config
storybook: {
webpackFinal(config, { configDir }) {
config.module?.rules.push({
test: /\.cjs$/,
use: {
loader: "babel-loader",
options: {
presets: ["@babel/preset-env"],
},
},
});
return config;
},
},
This was failing for me after updating to next bridge. Commenting as I landed here from Google.
Similarly, this config update got it to build:
build: {
extend(config) {
config.module?.rules.push({
test: /\.[cm]?js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
},
},
})
},
},
Nuxt Bridge now transpiles h3 by default. Is this still an issue you are experiencing?
I no longer use bridge, so I cannot say if this still occurs. Maybe @tarantoj-intrepid or @KevinBatdorf know more?
v4 of this module is no longer actively supported. Please try the newest version and open an new issue if the problem persists. Thank you for your understanding.