svelte-native icon indicating copy to clipboard operation
svelte-native copied to clipboard

"resolve.conditionNames" array warning about webpack.config.js

Open tonymurray opened this issue 2 years ago • 4 comments

When I create a default new Nativescript svelte application: ns create blankapp --svelte cd blankapp && ns debug android

I get a warning: WARNING: You should add "svelte" to the "resolve.conditionNames" array in your webpack config. See https://github.com/sveltejs/svelte-loader#resolveconditionnames for more information

The default webpack.config.js file is:

const webpack = require("@nativescript/webpack"); module.exports = (env) => { webpack.init(env); return webpack.resolveConfig(); };

Following some research/trial-and-error at: https://webpack.js.org/configuration/resolve/#resolveconditionnames I change webpack.config.js to:

const webpack = require("@nativescript/webpack"); module.exports = env => { webpack.init(env) module.exports = { resolve: { conditionNames: ['svelte'], }, } return webpack.resolveConfig() }

...Then the warning goes away. Is this an appropriate solution in relation to the warning?

tonymurray avatar Apr 11 '23 09:04 tonymurray

Thanks for the quick solution, you saved me a lot of time, @tonymurray!

ghost avatar Apr 14 '23 16:04 ghost

you can also just add this: webpack.mergeWebpack({ resolve: {conditionNames:['svelte','require','node'] }})

eikaramba avatar Apr 18 '23 12:04 eikaramba

Crazy this is still an open issue, just setup a brand new project and was greeted with this error. Is this something upstream in Native Script or in Svelte Native?

danawoodman avatar Feb 09 '24 07:02 danawoodman