What happened?
Observed as part of the upgrade v0.33.0 upgrade and this repro repo noticed that using a type import with the type inside the brackets breaks the build
import { type Page } from "@greenwood/cli";
const html: string = `
<h2>About Page</h2>
`;
const pages: Page[] = [];
console.log({ pages });
export default class AboutPage extends HTMLElement {
connectedCallback() {
this.innerHTML = html;
}
}
➜ greenwood-loops git:(chore/upgrade-greenwood-v0.33.0) ✗ npm run build
> greenwood-loops@1.0.0 build
> NODE_OPTIONS='--import @greenwood/cli/register' greenwood build
-------------------------------------------------------
Welcome to Greenwood (v0.33.0) ♻️
-------------------------------------------------------
Running Greenwood with the build command.
Initializing project config
Initializing project workspace contexts
Generating graph of workspace files...
building from local sources...
{ pages: [] }
pages to generate
/
generated page... /
success, done generating all pages!
bundling static assets...
{ pages: [] }
bundling dynamic pages...
Error: EISDIR: illegal operation on a directory, read
at async readFileHandle (node:internal/fs/promises:555:24)
at async Object.transform (file:///Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/@greenwood/cli/src/config/rollup.config.js:357:31)
at async transform (file:///Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/rollup/dist/es/shared/node-entry.js:20689:16)
at async ModuleLoader.addModuleSource (file:///Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/rollup/dist/es/shared/node-entry.js:20902:36) {
errno: -21,
code: 'PLUGIN_ERROR',
syscall: 'read',
pluginCode: 'EISDIR',
plugin: 'commonjs--resolver',
hook: 'resolveId',
id: '/Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/@greenwood/cli/src/lifecycles/config.js'
FWIW, this works fine, with the type on the outside
import type { Page } from "@greenwood/cli";
Steps to reproduce
- Started a Greenwood project w/ TypeScript
- Import a
type from the Greenwood CLI in an SSR page
- Run
greenwood build
Environment
Greenwood v0.33.0
Additional Context
Noticed that when logging from within Greenwood, it looks like the nested type is trying to bundle Greenwood? Rollup is trying to bundle a directory
bundling dynamic pages...
{
assetUrl: {
url: URL {
href: 'file:///Users/owenbuckley/Workspace/github/greenwood-loops/src/pages/about.ts',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '/Users/owenbuckley/Workspace/github/greenwood-loops/src/pages/about.ts',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
relativeAssetPath: '../src/pages/about.ts'
}
}
{
assetUrl: {
url: URL {
href: 'file:///Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/@greenwood/cli/src/lib/ssr-route-worker.js',
origin: 'null',
protocol: 'file:',
username: '',
password: '',
host: '',
hostname: '',
port: '',
pathname: '/Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/@greenwood/cli/src/lib/ssr-route-worker.js',
search: '',
searchParams: URLSearchParams {},
hash: ''
},
relativeAssetPath: '../lib/ssr-route-worker.js'
}
}
We should update the docs recommendation if we can't make this work - ProjectEvergreen/www.greenwoodjs.dev#215
What happened?
Observed as part of the upgrade v0.33.0 upgrade and this repro repo noticed that using a
typeimport with the type inside the brackets breaks the buildFWIW, this works fine, with the
typeon the outsideSteps to reproduce
typefrom the Greenwood CLI in an SSR pagegreenwood buildEnvironment
Greenwood v0.33.0
Additional Context
Noticed that when logging from within Greenwood, it looks like the nested type is trying to bundle Greenwood? Rollup is trying to bundle a directory
bundling dynamic pages... { assetUrl: { url: URL { href: 'file:///Users/owenbuckley/Workspace/github/greenwood-loops/src/pages/about.ts', origin: 'null', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/Users/owenbuckley/Workspace/github/greenwood-loops/src/pages/about.ts', search: '', searchParams: URLSearchParams {}, hash: '' }, relativeAssetPath: '../src/pages/about.ts' } } { assetUrl: { url: URL { href: 'file:///Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/@greenwood/cli/src/lib/ssr-route-worker.js', origin: 'null', protocol: 'file:', username: '', password: '', host: '', hostname: '', port: '', pathname: '/Users/owenbuckley/Workspace/github/greenwood-loops/node_modules/@greenwood/cli/src/lib/ssr-route-worker.js', search: '', searchParams: URLSearchParams {}, hash: '' }, relativeAssetPath: '../lib/ssr-route-worker.js' } }We should update the docs recommendation if we can't make this work - ProjectEvergreen/www.greenwoodjs.dev#215