Hiya, I've been using tsparticles in development for my Gatsby project with no problems, however when i'm building for production i get a webpack error saying
Describe the bug
"ERROR #98124 WEBPACK
Generating SSR bundle failed
an't resolve 'tsparticles'
What i've tried
Delete Node-Modules & Yarn.lock and reinstall.
Reinstall just tsparticles and react-tsparticles
updating gatsby-node to =>
exports.onCreateWebpackConfig = ({ actions }) => {
actions.setWebpackConfig({
resolve: {
modules: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'src'),
'node_modules'
],
},
})
}
Was hoping maybe i've just missed something silly with gatsby but would love to some help ! Thanks
Issue-Label Bot is automatically applying the label question to this issue, with a confidence of 0.77. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!
Links: app homepage, dashboard and code for this bot.
Hi @JonasWN,
The error you have is making me scratch my head.
Generating SSR bundle failed Can't resolve 'tsparticles'
The SSR bundle shouldn't have tsparticles or react-particles since they won't work. But if the error is reported only when building production I think it's a misconfiguration of Webpack.
Can you make a demo project on codesandbox or stackblitz to reproduce the problem? I've never used Gatsby and I don't know how to replicate the issue
Hi @matteobruni
I tried setting it up on codesandbox with just a gatsby starter and react-tsparticles and got the same build error half the time and another random one with "command failed with exit-code 137", so i'm not sure how reliable it is to you sorry :d but here's the link if it's any help
Heres the error in codesandbox

I've tried using require instead of import aswell
I think you're right it's an webpack misconfig or something with it can't find the right path for some reason
I've released the 1.16.1 version, this version should fix the issue, there was a wrong path in tsParticles package.json main file.