# LWC1704
Represents a missing resource value.
Severity: Error
# Message
Missing resource value for {0}
The error message format includes one placeholder: {0} is the full module specifier that's missing the resource value.
Example diagnostic messages:
LWC1704: Missing resource value for @salesforce/label
LWC1704: Missing resource value for @salesforce/unknownModule/value
# Problem
LWC1704 occurs when an import statement references a @salesforce module or unrecognized module without providing a required resource value. This error occurs during metadata collection when the compiler encounters module specifiers that are missing the resource identifier after the module type prefix, or when importing from modules that aren't recognized by any collector.
# Examples
LWC1704 occurs when the compiler validates module imports during metadata collection and can't determine the required resource value.
# 1. Missing Resource Value in @salesforce Modules
All @salesforce modules require a resource identifier after the module prefix. Common modules include:
- @salesforce/label, @salesforce/i18n, @salesforce/schema: Require the resource name, such as
/c.MyLabel,/country, or/Account - @salesforce/apex, @salesforce/apexContinuation: Require fully qualified method name in format
ClassName.methodNamewhen you use trailing slash - @salesforce/resourceUrl, @salesforce/contentAssetUrl, @salesforce/customPermission: Require the resource identifier
Importing these modules without a value or with only a trailing slash, such as @salesforce/label or @salesforce/apex/, triggers this error.
Note
@salesforce/apex without a trailing slash is valid when importing refreshApex, but @salesforce/apex/ with a trailing slash requires a method identifier.
# Examples with Errors
Here are several examples that return error code LWC1704.
Importing @salesforce modules without resource value:
import label from "@salesforce/label";
import myMethod from "@salesforce/apex/";
Error Message:
LWC1704: Missing resource value for @salesforce/label
Error Message:LWC1704: Missing resource value for @salesforce/apex/
# Error Resolution Examples
Here are several ways to fix error code LWC1704.
Provide the required resource identifier for @salesforce modules:
import myLabel from "@salesforce/label/c.MyCustomLabel";
import hasAdminAccess from "@salesforce/customPermission/AdminAccess";
import getAccounts from "@salesforce/apex/AccountController.getAccounts";
Valid usage for refreshApex (no trailing slash):
import { refreshApex } from "@salesforce/apex";
# 2. Unrecognized Modules
When importing from a module that doesn't match any known pattern (not a recognized @salesforce module, not an external npm package, not a local relative path, not an LWC module), the compiler can't determine how to handle it.
# Examples with Errors
Here's an example that returns error code LWC1704.
Importing from an unknown @salesforce module:
import something from "@salesforce/unknownModule/value";
Error Message:
LWC1704: Missing resource value for @salesforce/unknownModule/value
# Error Resolution Examples
Here are several ways to fix error code LWC1704.
Use valid imports or paths:
// Check for typos in @salesforce module names
import { getRecord } from 'lightning/uiRecordApi';
# 3. Reserved Modules
Some modules like @salesforce/loader are reserved for internal framework use and can't be imported directly by component authors.
# Examples with Errors
Here's an example that returns error code LWC1704.
Attempting to import reserved @salesforce/loader module:
import loader from "@salesforce/loader";
Error Message:
LWC1704: Missing resource value for @salesforce/loader
# Error Resolution Examples
Here are several ways to fix error code LWC1704.
Avoid importing reserved modules:
// Use standard JavaScript features like dynamic imports if required
await import('c/myComponent');
# LWC1704 Suggested Fix Steps
Consider these suggestions to fix LWC1704 errors.
# Step 1: Identify the Missing Resource
- Read the error message to identify which module is missing a resource value
- Locate the import statement in your code
- Determine if it's a @salesforce module, unrecognized module, or reserved module
# Step 2: Apply the Fix
For @salesforce modules, add the required resource identifier:
// Add resource after module prefix
import myLabel from "@salesforce/label/c.MyLabel";
import country from "@salesforce/i18n/country";
import ACCOUNT_OBJECT from "@salesforce/schema/Account";
import getAccounts from "@salesforce/apex/AccountController.getAccounts";
// For refreshApex, use named import without trailing slash
import { refreshApex } from "@salesforce/apex";
For unrecognized modules, fix the import path:
- Check for typos in @salesforce module names
- For npm packages, make sure that they're installed
- For local modules, use relative paths (
./or../) - For LWC components, use namespace/name format (
c/myComponent)
For reserved modules (like @salesforce/loader):
- Don't import them directly
- Use standard JavaScript features like dynamic imports:
await import('c/myComponent')
# Step 3: Verify the Fix
- Re-compile your component
- Make sure that LWC1704 no longer appears
- Test that the import works as expected
- Verify that the resource exists in your org (for @salesforce modules)