This repository was archived by the owner on Oct 7, 2024. It is now read-only.
This repository was archived by the owner on Oct 7, 2024. It is now read-only.
Stencil: v16.7.0 Cannot use import statement outside a module #7
Open
Description
Describe the bug
Using version 16.7.0 (unreleased on npm, forked from the main branch) and the latest "@stencil/core": "^4.1.0".
I understand there are reasons why this was not published yet, but this issue could be a heads-up. Maybe my setup is wrong and imports are broken for some reason. I could appreciate your help.
While running build target on a stencil library with angular and react output targets, it fails to with an error:
> nx run stencil:build
> NX Cannot use import statement outside a module
/node_modules/@nxext/stencil/src/executors/build/executor.ts:1
import { StencilBuildOptions } from './schema';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Object.newLoader [as .ts] (/node_modules/pirates/lib/index.js:121:7)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Function.Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:121:18)
at /node_modules/nx/src/config/schema-utils.js:21:24
To Reproduce
- Create nx [email protected] with @nx:angular and @nx:react apps and libs.
- Add "@nxext/stencil": "https://gitpkg.now.sh/antonselukh/nx-extensions/packages/stencil?main", or directly from main branch of this repo
- create a stencil lib
- build it
Expected behavior
It should be able to import a schema json file, and cause no console errors.
Additional context
> NX Report complete
Node : 18.17.1
OS : darwin-arm64
yarn : 1.22.19
nx : 16.7.2
@nx/js : 16.7.2
@nx/jest : 16.7.2
@nx/linter : 16.7.2
@nx/workspace : 16.7.2
@nx/angular : 16.7.2
@nx/cypress : 16.7.2
@nx/devkit : 16.7.2
@nx/eslint-plugin : 16.7.2
@nx/express : 16.7.2
@nx/node : 16.7.2
@nx/playwright : 16.7.2
@nx/react : 16.7.2
@nx/rollup : 16.7.2
@nx/storybook : 16.7.2
@nrwl/tao : 16.7.2
@nx/web : 16.7.2
@nx/webpack : 16.7.2
nx-cloud : 16.4.0-beta.1
typescript : 5.1.6
---------------------------------------
Community plugins:
@nxext/stencil : 16.7.0
@storybook/angular : 7.3.2