-
Notifications
You must be signed in to change notification settings - Fork 72
Closed
Description
A module warning is appearing after each build. Compiled code works.
Error
> Module Warning (from ./node_modules/svelte-loader/index.js):
'image' is not defined (25:10)
23: <h1>Hello {name}!</h1>
24: {#if obj?.value}{obj.value}{/if}
25: <img src={image} alt="Test" />
^
26: <div class="box">asda</div>
27: @ ./src/index.ts 1:0-31 3:16-19
App.svelte
<script type="ts">
import image from "./test.png"
export let name: string
$: name = name ?? "world"
</script>
<h1>Hello {name}!</h1>
<img src={image} alt="Test" />
Webpack
{
test: /\.svelte$/,
use: {
loader: "svelte-loader",
options: {
compilerOptions: {
dev: argv.mode === "development",
},
emitCss: true,
preprocess: sveltePreprocess({
postcss: true,
babel: {
plugins: [
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
],
presets: [
[
"@babel/preset-env",
{
loose: true,
modules: false,
targets: {
esmodules: true,
},
},
],
],
},
}),
},
},
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ["file-loader"],
},
Version:
"@babel/core": "^7.14.2",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.14.2",
"@tsconfig/svelte": "^1.0.10",
"svelte-check": "^1.5.4",
"svelte-jester": "^1.5.0",
"svelte-loader": "^3.1.1",
"svelte-preprocess": "^4.7.3",
"webpack": "^5.37.0",
"webpack-cli": "^4.7.0",
"webpack-dev-server": "^3.11.2"
Metadata
Metadata
Assignees
Labels
No labels