Using a StencilJS output in another StencilJS project

Open
#6,641 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
typescript
Domain
build-system

Research direction

Start by reviewing the core package's dist/collection output and dist/types imports described in the issue, then trace how an imported type or mixin affects the consuming StencilJS build. Establish the expected behavior for importing types or mixins without including components, and identify the relevant build or packaging tests needed to verify it.

Written by the indexing model from the issue text.

Description

Stencil v5
Prerequisites
Describe the Feature Request

From a other StencilJS package, types, mixins, etc. can be imported using import.

Describe the Use Case

There is a core package, which is a StencilJS project containing basic components (button, table, …) and utilities.

In another StencilJS project, the type definitions, basic components, and utilities should be imported from the core package.

Currently, everything is provided in the collection folder within the dist directory of the core package.

This means that, in theory, a type definition or mixin can be imported.

import { defaultFactory } from ‘project/core/collection/mixins/default’;

import { HTMLDefaultElement } from ‘@boilerplate-stencil/core/dist/types’;

Problem
When an import is used (whether a type definition or a mixin), the core package is directly incorporated into the rest of the project, meaning components become known and are included in the build.
However, it may be that only a type definition was imported.

Describe Preferred Solution

It feels like tree shaking is missing here?

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Dominant language
TypeScript
Stars
13.1k
Forks
855
Avg merge
4h 7m
Merged PRs (30d)
44

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from stenciljs/core

All issues in stenciljs/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.