I’m building a webapp using Parcel to bundle.
Everything was working right at the front, but then I started the back setting the data base and got this error from parcel.
???? Build failed.
@parcel/core: node_modules/pg-cloudflare/dist/empty.js does not export 'CloudflareSocket'
C:UsersAdministratorDesktopcarreranivel-3modulo-7desafio-m7node_modulespglibstream.js:10:13
9 | } else {
> 10 | const { CloudflareSocket } = require('pg-cloudflare')
> | ^^^^^^^^^^^^^^^^
11 | return new CloudflareSocket(ssl)
12 | }
This is my sequelize setting
import { Sequelize } from "sequelize"
require('dotenv').config();
const sequelize = new Sequelize(process.env.SEQUELIZE_ACCOUNT_URL, {
host: 'host-name',
dialectModule: require('pg'),
sync: {
alter: true
},
dialect: 'postgres',
dialectOptions: {
ssl: {
rejectUnauthorized: false,
require: true
}
}
});
This is my package.json
{
"name": "mvc",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"source": "src/index.html",
"scripts": {
"dev:parcel": "parcel",
"dev": "nodemon --watch ./endpoints.ts --exec "ts-node" endpoints.ts",
"dev:endpoints": "nodemon --watch ./be-src/endpoints.ts --exec ts-node ./be-src/endpoints.ts",
"build": "parcel build",
"sync": "ts-node ./be-src/sync.ts"
},
"dependencies": {
"@types/cors": "^2.8.17",
"@types/node": "^20.11.22",
"@vaadin/router": "vaadin/router",
"algoliasearch": "^4.23.3",
"cloudinary": "^2.0.3",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"dropzone": "^6.0.0-beta.2",
"express": "^4.18.3",
"parcel": "^2.12.0",
"pg-hstore": "^2.3.4",
"sequelize": "^6.37.3",
"ts-node": "^10.9.2"
},
"devDependencies": {
"assert": "^2.0.0",
"buffer": "^5.5.0||^6.0.0",
"console-browserify": "^1.2.0",
"crypto-browserify": "^3.12.0",
"events": "^3.1.0",
"https-browserify": "^1.0.0",
"nodemon": "^3.1.0",
"os-browserify": "^0.3.0",
"path-browserify": "^1.0.0",
"pg": "^8.11.5",
"process": "^0.11.10",
"querystring-es3": "^0.2.1",
"stream-browserify": "^3.0.0",
"stream-http": "^3.1.0",
"string_decoder": "^1.3.0",
"typescript": "^5.4.5",
"url": "^0.11.0",
"util": "^0.12.3",
"vm-browserify": "^1.1.2"
}
}
I’m pretty new at this, so if more info may be needed to give me some help, I’ll be glad to give it.
I hope someone can help me, I’ve been for more than a week now, looking through the entire internet for documentation to help me get this solve but didn’t find anything????
I tried changing the Sequelize db config from:
dialectModule: require('pg')
to an import, like this:
import pg from 'pg'
dialectModule: pg
also tried using webpack, but because I’ve never used it before, I though it would make the headache even worst
Adrián Leiva is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.