Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle still has import statements for Lit #223

Open
datvm opened this issue Oct 28, 2023 · 0 comments
Open

Bundle still has import statements for Lit #223

datvm opened this issue Oct 28, 2023 · 0 comments

Comments

@datvm
Copy link

datvm commented Oct 28, 2023

  • Version: 3.4.5
  • Rollup Version: 4.1.5
  • Operating System and version (if applicable): Windows 11
  • Node Version (if applicable): v18.16.1
  • Does it work with tsc (if applicable): yes

Reproduction

I am trying to bundle material-components/material-web so I cloned it there and added rollup and rollup-plugin-ts and nothing else:

    "rollup": "^4.1.5",
    "rollup-plugin-ts": "^3.4.5",

Running rollup -c is successful and all is packed except Lit components. These are the result files:

image

// all.bundled.js
import { customElement, property, state, query, queryAssignedElements, queryAll, queryAsync, queryAssignedNodes } from 'lit/decorators.js';
import { LitElement, html, css, isServer, nothing, render } from 'lit';
import { classMap } from 'lit/directives/class-map.js';
import { literal, html as html$1 } from 'lit/static-html.js';
import { styleMap } from 'lit/directives/style-map.js';
import { when } from 'lit/directives/when.js';
import { live } from 'lit/directives/live.js';

// Other content...
// all.bundled.d.ts
import { LitElement, ReactiveElement, PropertyValues, TemplateResult, nothing, ReactiveController, ReactiveControllerHost } from "lit";
import { ClassInfo } from "lit/directives/class-map.js";
import { StaticValue } from "lit/static-html.js";

// License info

declare const internals: unique symbol;
// Others

This is my rollup.config.js:

import ts from "rollup-plugin-ts";

const config = [
  {
    input: "./all.ts",
    output: [{
      file: "./catalog/dist/all.bundled.js",
      format: "esm",
    }],
    plugins: [
      ts({
        tsconfig: "tsconfig.json",
      }),
    ],
  },
];

export default config;

Expected Behavior

Everything should be contained within the bundled file. No import statement should be there.

Actual Behavior

import statements at the beginning of the file. I also tried switching to @rollup/plugin-typescript and it gives the same result as well, all references to Lit are kept with import.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant