0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

LWC1503

Last updated at Posted at 2023-10-10

image.png

Code must be written inside the body of the class; if you read carefully the error message indicates the same.

https://salesforce.stackexchange.com/questions/301342/lwc1503-parsing-error-leading-decorators-must-be-attached-to-a-class-declarati

we need to enable LWS under session settings. Setup -> Session Settings -> Enable "Use Lightning Web Security for Lightning web components and Aura components". Also please make sure your in VS code, org-api-version is 58.0 or above. You can check the same using

sf config list 

Also, the meta-xml of your component should contain the capabilities property if you want to make use of dynamic instantiation

<?xml version="1.0" encoding="UTF-8"?>
    <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>59.0</apiVersion>
    <capabilities>
        <capability>lightning__dynamicComponent</capability>
    </capabilities>
</LightningComponentBundle>

image.png

change

@Salesforce/apex/WireApexDemo1.getoppo

to (small 's' since JS is case-sensitive):

@salesforce/apex/WireApexDemo1.getoppo

and as already been said check your java version:

https://www.youtube.com/watch?v=BwBNsLBpnVs

LWC1702

image.png

I have got the same problem , solved the issue with forward slash

import { createElement } from "lwc/";

import { createElement } from '@lwc/engine-dom';

Adding this resolved the error for me.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?