Q: Marking a Path as External
I've just encountered this error message:
From this code:
✘ [ERROR] Could not resolve "$env/static/public"
src/lib/api/weather.ts:1:39:
1 │ import { PUBLIC_WEATHER_API_KEY } from '$env/static/public';
╵ ~~~~~~~~~~~~~~~~~~~~
You can mark the path "$env/static/public" as external to exclude it from the bundle, which will
remove this error.
⠋ Preparing Convex functions...
✘ [ERROR] Could not resolve "$env/static/public"
src/lib/api/weather.ts:1:39:
1 │ import { PUBLIC_WEATHER_API_KEY } from '$env/static/public';
╵ ~~~~~~~~~~~~~~~~~~~~
You can mark the path "$env/static/public" as external to exclude it from the bundle, which will
remove this error.✘ [ERROR] Could not resolve "$env/static/public"
src/lib/api/weather.ts:1:39:
1 │ import { PUBLIC_WEATHER_API_KEY } from '$env/static/public';
╵ ~~~~~~~~~~~~~~~~~~~~
You can mark the path "$env/static/public" as external to exclude it from the bundle, which will
remove this error.
⠋ Preparing Convex functions...
✘ [ERROR] Could not resolve "$env/static/public"
src/lib/api/weather.ts:1:39:
1 │ import { PUBLIC_WEATHER_API_KEY } from '$env/static/public';
╵ ~~~~~~~~~~~~~~~~~~~~
You can mark the path "$env/static/public" as external to exclude it from the bundle, which will
remove this error.From this code:
export const add = mutation({
args: {
quant: v.number(),
qual: v.string(),
user: v.string(),
latitude: v.string(),
longitude: v.string()
},
handler: async (ctx, args) => {
const weather = (await getWeatherInformationFromCoordinates(
args.latitude,
args.longitude
)) as WeatherAPIData;
return await ctx.db.insert('responses', {
user: 'Sam',
quant: args.quant,
qual: args.qual,
latitude: args.latitude,
longitude: args.longitude,
country: weather.location.country,
region: weather.location.region,
datetime: new Date().toJSON(),
isDay: weather.current.is_day,
weather: weather.current.condition.text,
cloudCover_percent: weather.current.cloud,
humidity_percent: weather.current.humidity,
heatIndex_C: weather.current.heatindex_c,
temp_C: weather.current.temp_c,
tempFeelsLike_C: weather.current.feelslike_c
});
}export const add = mutation({
args: {
quant: v.number(),
qual: v.string(),
user: v.string(),
latitude: v.string(),
longitude: v.string()
},
handler: async (ctx, args) => {
const weather = (await getWeatherInformationFromCoordinates(
args.latitude,
args.longitude
)) as WeatherAPIData;
return await ctx.db.insert('responses', {
user: 'Sam',
quant: args.quant,
qual: args.qual,
latitude: args.latitude,
longitude: args.longitude,
country: weather.location.country,
region: weather.location.region,
datetime: new Date().toJSON(),
isDay: weather.current.is_day,
weather: weather.current.condition.text,
cloudCover_percent: weather.current.cloud,
humidity_percent: weather.current.humidity,
heatIndex_C: weather.current.heatindex_c,
temp_C: weather.current.temp_c,
tempFeelsLike_C: weather.current.feelslike_c
});
}