Skip to content

[Svelte] Warning / suggested configuration when installing via composer #1012

Closed
@daniels0056

Description

@daniels0056

Installing ux-svelte via composer require symfony/ux-svelte have warning / missing webpack config entry. I'm not sure though if this is related to Svelte or UX, since it does not export the path ./internal when adding conditionNames to the Webpack configuration.

The problem

  • Create a new project by symfony new --webapp my-app
  • Add Svelte to project composer require symfony/ux-svelte
  • Build dependencies using yarn yarn install && yarn build

Dependencies added and installed:

{
    "devDependencies": {
        ...
        "@symfony/stimulus-bridge": "^3.2.0",
        "@symfony/ux-svelte": "file:vendor/symfony/ux-svelte/assets",
        ...
        "svelte": "^3.0",
        "svelte-loader": "^3.1.9",
        ...
    },
   ...
}

This produces a warning, but still build successfully:

WARNING: You should add "svelte" to the "resolve.conditionNames" array in your webpack config. See https://github.com/sveltejs/svelte-loader#resolveconditionnames for more information

Attempting to fix the warning by changing default webpack configuration:

let config = Encore.getWebpackConfig();
config.resolve.conditionNames = ["svelte"];
module.exports = config;

This will produce, if attempting to build again by yarn build, the following error message:

ERROR  Failed to compile with 1 errors                                                                                                                                                                                                   
error  in ./assets/svelte/controllers/Hello.svelte                                                                                                                                                                                       

Module not found: Error: Package path ./internal is not exported from package ./node_modules/svelte (see exports field in ./node_modules/svelte/package.json)

Which can be fixed by updating Svelte to ^4.0 in packages.json, this is however probably a "solution" unless ux-svelte can increment Svelte version without breaks:

{
    "devDependencies": {
        ...
        "svelte": "^3.0",
        ...
    },
   ...
}

With a single dependency warning from ux-svelte:

warning " > @symfony/ux-svelte@1.0.0" has incorrect peer dependency "svelte@^3.0".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions