samuelweckstrom/react-dvd-screensaver

Unexpected token 'export' error

Closed this issue · 1 comments

Node 16.13.2, NextJS 12.0.9, React & React-dom 17.0.2.

using both Hooks and Components, I'm getting a SyntaxError. Does this also have something to do with the peer dependencies being out of date?

Lastly, the demo on CodePen capitalizes the third 'S' in the useDvdScreenSaver hook, where the GitHub documentation does not.

do npm i -s next-transpile-modules

next.config.js

`/** @type {import('next').NextConfig} */
const withTM = require('next-transpile-modules')(['react-dvd-screensaver']) // first import this plugin with reaflow as a target

const nextConfig = {
reactStrictMode: false,
swcMinify: true,
}

module.exports = withTM({
...nextConfig,
experimental: {
esmExternals: 'loose', // second add this experimental flag to the config
},
})
`