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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugins with HTML imports break in the default Aurelia makes skeleton #1777

Open
Vheissu opened this issue Jun 14, 2023 · 3 comments
Open

Plugins with HTML imports break in the default Aurelia makes skeleton #1777

Vheissu opened this issue Jun 14, 2023 · 3 comments
Assignees
Labels
Bug Something isn't working

Comments

@Vheissu
Copy link
Member

Vheissu commented Jun 14, 2023

馃悰 Bug Report

I have been working on porting over https://github.com/aurelia-ui-toolkits/aurelia-mdc-web to Aurelia 2. Porting aside, when I attempt to consume the v2 version of the plugin in the default npx makes aurelia skeleton with Webpack, it complains about various .html files being imported not having a loader.

To fix this, I had to modify the default HTML loader and remove the exclusion rule for node modules:

        {
          test: /\.html$/i,
          use: '@aurelia/webpack-loader'
        },

You can replicate this issue by installing @aurelia2-mdc-web/all in a fresh Aurelia 2 project using makes and pulling in some of the packages

import { BaseConfiguration } from "@aurelia2-mdc-web/base";
import { ButtonConfiguration } from "@aurelia2-mdc-web/button";
import { CheckboxConfiguration } from "@aurelia2-mdc-web/checkbox";
import { ChipsConfiguration } from "@aurelia2-mdc-web/chips";
import { CircularProgressConfiguration } from "@aurelia2-mdc-web/circular-progress";
import { DialogConfiguration } from "@aurelia2-mdc-web/dialog";

Aurelia.register(
  BaseConfiguration,
  ButtonConfiguration,
  CheckboxConfiguration,
  ChipsConfiguration,
  CircularProgressConfiguration,
  DialogConfiguration,
)
  .app(MyApp)
  .start();

@Vheissu Vheissu added the Bug Something isn't working label Jun 14, 2023
@Sayan751
Copy link
Contributor

cc: @3cp

@3cp
Copy link
Member

3cp commented Dec 29, 2023

If you start an Aurelia 2 plugin project, the html files will be compiled by @aurelia/webpack-loader into js code during npm run build.

The final npm package contains no original html file. Hence when you consume this new plugin package in an app project, there is no .html issue anymore because all the plugin package exposes is one dist js file.

This is different from Aurelia 1 which deals with html at runtime, not compile time. So html file retains as html file in Aurelia 1 plugin package. This is not the case anymore for Aurelia 2 plugin.

So setup Aurelia 2 plugin project properly, the html files will be handled in build time.

@bigopon
Copy link
Member

bigopon commented May 11, 2024

It seems we don't need this ticket, as the original usage of npx makes Aurelia wasn't right, as it was for app instead of plugin. Let's close this @Vheissu ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants