Skip to content

I am attempting to bundle my Node.js TypeScript backend application code and dependencies (node_modules) into a single JavaScript file named "bundle.js". #9750

Description

@sallyzoughaib

@sentry/node
@sentry/node: ^7.77.0
using window 11 pro

I am attempting to bundle my Node.js TypeScript backend application code and dependencies (node_modules) into a single JavaScript file named "bundle.js".

This is my rollup.config.js filer:

import nodeBuiltins from 'rollup-plugin-node-builtins';
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
import tslibResolveId from 'rollup-plugin-tslib-resolve-id';
import json from '@rollup/plugin-json';
export default {
input: 'src/server.ts',
output: {
file: 'dist/bundle.js',
format: 'cjs',
},
plugins: [
tslibResolveId(),
nodeBuiltins(),
typescript(),
json(),
commonjs({
include: 'node_modules/**',
ignoreGlobal: false,
sourceMap: false,
}),
resolve(),
],
};

package.json :

 "dependencies": {
"@rollup/plugin-alias": "^5.1.0",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"@sentry/node": "^7.77.0",
"@sentry/profiling-node": "^1.2.5",
"@types/multer": "^1.4.7",
"axios": "^1.4.0",
"bcrypt": "^5.1.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"compression": "^1.7.4",
"cookie-parser": "^1.4.6",
"cors": "^2.8.5",
"csv-parse": "^5.3.3",
"dotenv": "^16.0.3",
"envalid": "^7.3.1",
"express": "^4.18.2",
"express-query-booleanizer": "^0.0.16",
"express-validator": "^6.14.2",
"handlebars": "^4.7.7",
"helmet": "^6.0.1",
"hpp": "^0.2.3",
"jsonwebtoken": "^9.0.0",
"logform": "^2.4.2",
"moment": "^2.29.4",
"morgan": "^1.10.0",
"mssql": "^9.1.0",
"multer": "^1.4.5-lts.1",
"rxjs": "^7.8.0",
"sequelize": "^6.28.0",
"sequelize-auto": "^0.8.8",
"tedious": "^15.1.3",
"winston": "^3.8.2",
"winston-daily-rotate-file": "^4.7.1",
"xlsx": "^0.18.5",
"xlsx-populate": "^1.21.0"
},
"devDependencies": {
"@babel/core": "^7.20.12",
"@babel/types": "^7.20.7",
"@rollup/plugin-json": "^6.0.1",
"@types/bcrypt": "^5.0.0",
"@types/compression": "^1.7.2",
"@types/cookie-parser": "^1.4.3",
"@types/cors": "^2.8.13",
"@types/express": "^4.17.15",
"@types/hpp": "^0.2.2",
"@types/jsonwebtoken": "^9.0.1",
"@types/lodash": "^4.14.191",
"@types/morgan": "^1.9.4",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "^5.62.0",
"@typescript-eslint/parser": "^5.62.0",
"cross-env": "^7.0.3",
"eslint": "^8.45.0",
"eslint-config-prettier": "^8.6.0",
"eslint-plugin-prettier": "^4.2.1",
"lint-staged": "^13.1.0",
"node-config": "^0.0.2",
"node-gyp": "^9.3.1",
"nodemon": "^2.0.20",
"pm2": "^5.2.2",
"prettier": "^2.8.3",
"ts-node": "^10.9.1",
"tsc-alias": "^1.8.2",
"tsconfig-paths": "^4.1.2",
"tslib": "^2.4.1",
"typescript": "^4.9.4"
}

I got this error when i ran npm run build

where build : rollup -c

Error: [!] (plugin rpt2) Error: Unexpected character '�' (Note that you need plugins to import files that are not JavaScript)node_modules/@sentry/profiling-node/lib/sentry_cpu_profiler-darwin-x64-93.node (1:0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions