Prisma1: Support require syntax for modules

Created on 22 Oct 2017  路  7Comments  路  Source: prisma/prisma1

Currently, using require in a function results in this error when deploying:

image

This should be supported.

All 7 comments

I can require any module I want using the require syntax. I only get the startsWith error if I use any line breaks, for which I have already submitted a PR. See https://github.com/graphcool/graphcool/issues/962

I did something like this:

import sendgrid = require('@sendgrid/mail')

which resulted in that error.

That's not a supported syntax at all in any ES version. It's either import sendgrid from '@sendgrid/mail' or const sendgrid = require('@sendgrid/mail'.

The combination of import and require is breaking up the regexes, but this is not a bug IMHO.

@kbrandwijk that's true, it's a mix of both, but TypeScript supports it :) https://www.typescriptlang.org/docs/handbook/modules.html

The regex is only there to protect legacy projects from breaking, so it's ok when it's just ignoring this.

As the handbook and the so link say, it's only possible with modules exported using the export = syntax.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ragnorc picture ragnorc  路  3Comments

akoenig picture akoenig  路  3Comments

schickling picture schickling  路  3Comments

marktani picture marktani  路  3Comments

marktani picture marktani  路  3Comments