wewowweb / laravel-mix-svelte

mix.svelte();
MIT License
68 stars 10 forks source link

WARNING: You should add "svelte" to the "resolve.conditionNames" array in your webpack config. #31

Open artfulrobot opened 1 year ago

artfulrobot commented 1 year ago

I've used this extension for years - thank you - but I came to use it again today on a new project and when doing npx mix I get this 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

I have tried the following in my webpack.mix.js to no avail:

mix                                                   
  .js('src/adminux.js', 'dist')
  .webpackConfig({
    resolve: {
      alias: {  
        svelte: path.resolve('node_modules', 'svelte')
      }, 
      conditionNames: ['svelte']                      
    },
  })                                                  
  .svelte();

I tried it without the alias bit too - trying to copy bits from https://github.com/sveltejs/svelte-loader

morpheus7CS commented 1 year ago

Hey @artfulrobot,

thanks for letting me know. I will try to check this out by the end of the week and see if I can come up with any solutions.

If you (or anyone else using the package) come up with anything in the meantime, feel free to pull request the changes.

On that note, I'm also hoping to bring this package to v1 sometime sooner rather than later, with Vite support included, so that people can keep using it even on newer Laravel versions.

Thanks again and kind regards, g

artfulrobot commented 1 year ago

@morpheus7CS Sounds good. I'm just ignoring it for now as to be honest, for me, the whole point of using laravel mix was so I didn't have to learn webpack/others! Everyone's talking about Vite and I feel another learning curve coming on! :weary:

morpheus7CS commented 1 year ago

Hey @artfulrobot,

I have included the link to the issue that previously existed in the svelte-loader repository, which describes the problem much like you described.

@alesvaupotic helped out today by diving deeper into the issue, since I found it weird that the compilation itself doesn't seem to be affected, only the error remains.

So far, our code will remain as is, but we will put in a sensible default as soon as we can hook into it.

So, I think we can monitor the situation on the svelte-loader side, but mostly I think you can be sure that despite the warning your compilation should continue to work as it has.

Kind regards, g