Skip to content

Referenced images are not found during compile #45

@jacwright

Description

@jacwright

The emitted css is put into a temp folder outside the path of the project, making it impossible to include images in the css.

webpack.config.js

      "rules": [
...
      {
        test: /\.html$/,
        use: {
          loader: 'svelte-loader',
          options: {
            emitCss: true,
          }
        }
      }

Projects.html

<style>
.logo {
  background: url(../images/logo.png) no-repeat center;
}
</style>

Gives a compile error:

ERROR in ./node_modules/css-loader!/var/folders/b5/j22nvd1n37bfj3nkpn_q8ld80000gp/T/svelte-pbcwuy.css
    Module not found: Error: Can't resolve '../images/logo.png' in '/var/folders/b5/j22nvd1n37bfj3nkpn_q8ld80000gp/T'
     @ ./node_modules/css-loader!/var/folders/b5/j22nvd1n37bfj3nkpn_q8ld80000gp/T/svelte-pbcwuy.css 7:2874-2903

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions