Add pg library to atom package


I’m trying to create a package that connects to a postgres database, but I receive the next error.

Uncaught EvalError: Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of script in the following Content Security Policy directive: "script-src 'self'".

I already read about loophole in this cases but seeing another package like data atom, they didn’t use it.
Could you help me with this?

This is my main.js package:

'use babel';
import TestPostgresView from './test-postgres-view';
import { CompositeDisposable } from 'atom';
var pg = require('pg');
export default {
    testPostgresView: null,
    modalPanel: null,
    subscriptions: null,
activate(state) {
    this.testPostgresView = new TestPostgresView(state.testPostgresViewState);
    this.modalPanel = atom.workspace.addModalPanel({
      item: this.testPostgresView.getElement(),
      visible: false
    // Events subscribed to in atom's system can be easily cleaned up with a CompositeDisposable
    this.subscriptions = new CompositeDisposable();
    // Register command that toggles this view
    this.subscriptions.add(atom.commands.add('atom-workspace', {
      'test-postgres:toggle': () => this.toggle()
  deactivate() {
  serialize() {
    return {
      testPostgresViewState: this.testPostgresView.serialize()
  toggle() {
    console.log('TestPostgres was toggled!');
    var conString = 'postgres://postgres:postgres@localhost:5432/postgres';
    var query = 'select now();';
    pg.connect(conString, function (err, client, done) {
        if (err) {
            logger.error('Error fetching client from pool', err);
            return callback(err);
        client.query(query, function (err, result) {
            if (err) {
                logger.error('Error running: ', err);
                logger.error('Error running: ', query);
            return callback(err, result)


Hi @leedohm could you help me on this?


loophole would be my only suggestion. I’ve never tried to access a Postgres database from Atom.