I know it is a bad practice to use the import
as well as require
statements in the same file, but I heard it shouldn't cause any problems.
Why will my lambda fail then (when running yarn run local
) and complain about an 'Unexpected Identifier' when encountering the import
statement?
Here's the current codebase. The problem lies in the functions/edge.js file.
EDIT: I'm sorry I haven't clearly formulated my question. Replacing the import statement with the seemingly equivalent const middleware = require('@sapper/server');
results in an error: It can't find the module - with import it works perfectly fine, even during production.