Skip to content

Imported prop types lead to errors #178

@chris-si

Description

@chris-si

Hi,

I just tried to use the vue-email compiler (v0.8.7) in a node (v20) server environment but I unfortunately came across a little hurdle with the props of a vue component.

In my vue component I'm importing the props interface from an 'external' file because I also need the same interface in some other places.

Unfortunately this leads to the following error:

Error loading component Error: [@vue/compiler-sfc] No fs option provided to `compileScript` in non-Node environment. File system access is required for resolving imported types.

MyTemplate
76 |  import { MyProps } from '../types';
77 |  
78 |  const props = withDefaults(defineProps<MyProps>(), {
   |                                         ^^^^^^^^^
...
    at ScriptCompileContext.error (.../node_modules/@vue-email/compiler/dist/index.cjs:47006:11)
    at importSourceToScope (.../node_modules/@vue-email/compiler/dist/index.cjs:47568:16)
    at resolveTypeFromImport (.../node_modules/@vue-email/compiler/dist/index.cjs:47562:23)
    at innerResolveTypeReference (.../node_modules/@vue-email/compiler/dist/index.cjs:47472:14)
    at resolveTypeReference (.../node_modules/@vue-email/compiler/dist/index.cjs:47461:36)
    at innerResolveTypeElements (.../node_modules/@vue-email/compiler/dist/index.cjs:47116:24)
    at resolveTypeElements (.../node_modules/@vue-email/compiler/dist/index.cjs:47073:35)
    at resolveRuntimePropsFromType (.../node_modules/@vue-email/compiler/dist/index.cjs:48398:20)
    at genRuntimePropsFromTypes (.../node_modules/@vue-email/compiler/dist/index.cjs:48374:17)
    at genRuntimeProps (.../node_modules/@vue-email/compiler/dist/index.cjs:48364:18)

Is there any way to enable the respective option in order to be able to import prop types?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions