#Building / using stencil locally

1 messages · Page 1 of 1 (latest)

upbeat grail
#

CONTRIBUTING.md seems to be a bit out of date, and I'm having some issues building stencil locally.

First off:

  1. (Optional) If you are working on Jest support, see the installation steps in that directory's README.

This step seems not to be optional, as npm run build fails without it.

Lots of errors:

src/testing/jest/jest-28/jest-environment.ts:3:10 - error TS2305: Module '"jest-environment-node"' has no exported member 'TestEnvironment'.

3 import { TestEnvironment as NodeEnvironment } from 'jest-environment-node';

...

running npm run install.jest seems to fix things.

However, when I build npm run build from the v4.15.0 tag, compiler/stencil.js~~ is in esm~~ format, whereas compiler/stencil.js from npm is in commonJS .

How can I build the commonjs version?

#

Running npm run release.ci -- --tag dryrun --dry-run seems to get me the same output as is on npm

brittle mantle
#

CONTRIBUTING.md seems to be a bit out of date, and I'm having some issues building stencil locally.

Thanks for the heads up, I can fix that real quick

#

RE: The differences you're seeing in build output - We're working on building Stencil itself using esbuild rather than rollup. npm run build uses the esbuild infrastructure, but we're still producing production builds using rollup (which is why the npm run release.ci step produces something different)

However, we shouldn't be producing different module output, as we expressly tell esbuild ot use CJS over ESM. Can you let me know what the git SHA is that you're building with and a snippet of compiler/stencil.js that looks to be ESM?

upbeat grail
#

Hey Ryan,

Yeah, I did a bit of digging and figured that out, ended up modifying the build script to call the release (rollup) build.

Can you let me know what the git SHA

The latest release tag, and main.

as we expressly tell esbuild ot use CJS over ESM.

Yeah, sorry, I was wrong about the esm, I saw var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); and didn't scroll down to the exports.

It seems like the esbuild version works when used from the cli, but not when used programatically in node.

I get the following error:

TypeError: Cannot read properties of undefined
                  (reading 'loadConfig')

with the following code:

import stencil from '@stencil/core/compiler';

// ...

        const validated = await stencil.loadConfig({
            config: {
                flags,
                ...stencilConfig,
            },
            logger,
            sys,
        });

// ...
brittle mantle
#

Could you do me a favor in the Stencil repo? I'd like to take a closer look here

brittle mantle
upbeat grail
upbeat grail