-
Notifications
You must be signed in to change notification settings - Fork 48
Description
Hi! I'm trying to use the @solidity-parser/parser npm package within a Next JS typescript project. Unfortunately, when I try to import something:
import {parse} from "@solidity-parser/parser"
I get this error
Uncaught TypeError: __webpack_require__(...).join is not a function
at eval (index.cjs.js?6069:25092:70)
at eval (index.cjs.js?6069:22:1)
at eval (index.cjs.js?6069:36856:1)
at ./node_modules/@solidity-parser/parser/dist/index.cjs.js (index.js?ts=1658252725362:17:1)
at options.factory (webpack.js?ts=1658252725362:661:31)
at __webpack_require__ (webpack.js?ts=1658252725362:37:33)
at fn (webpack.js?ts=1658252725362:316:21)
at eval (webpack-internal:///./components/analysis/AnalysisTab.tsx:13:81)
at ./components/analysis/AnalysisTab.tsx (index.js?ts=1658252725362:134:1)
at options.factory (webpack.js?ts=1658252725362:661:31)
at __webpack_require__ (webpack.js?ts=1658252725362:37:33)
at fn (webpack.js?ts=1658252725362:316:21)
at eval (webpack-internal:///./pages/index.tsx:18:90)
at ./pages/index.tsx (index.js?ts=1658252725362:266:1)
at options.factory (webpack.js?ts=1658252725362:661:31)
at __webpack_require__ (webpack.js?ts=1658252725362:37:33)
at fn (webpack.js?ts=1658252725362:316:21)
at eval (?1d0a:5:16)
at eval (route-loader.js?ea34:215:51)
I haven't been able to find a similar error anywhere else on the web. It looks like it has something to do with the webpack configuration and the way the module is being imported. But the error is being caused by one of the files as a part of the latest package release.
I don't have a lot of experience in module importing so I can't tell if this is me not setting up my project correctly or if it is an issue with the release itself. Any help would be appreciated and if this is an issue with the package, I hope I can help fix it.
More details
I've also included my NextJS and Typescript configuration files which are pretty standard in case they help give insight into this issue.
tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"downlevelIteration": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "custom.d.ts"],
"exclude": ["node_modules"]
}
next.config.js:
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
webpack(config) {
config.module.rules.push({
test: /\.svg$/,
use: ["@svgr/webpack"]
});
return config;
}
}
module.exports = nextConfig