Coder Social home page Coder Social logo

Comments (4)

aabounegm avatar aabounegm commented on August 11, 2024

In the linked issue, the problem was a wrong import style in the documentation for the Rollup config. The comment you quoted is not specific to Rollup, it just happened to be the bundler used by that issue's OP.

If you followed the installation instructions in the docs and it still doesn't work, it would be great if you can share the code with which we can reproduce the issue.
If you are just asking whether it applies and didn't try yet, I encourage you to use the Discussions section in the repo instead :)

from attractions.

jcschmidig avatar jcschmidig commented on August 11, 2024

Sorry for misinterpreting the comment.
I set up a simplified repository to show my problem: https://github.com/jcschmidig/mfe-svelte-attractions.
Thanks for having a look!

from attractions.

illright avatar illright commented on August 11, 2024

Thanks for the MFE. Given my limited expertise with Webpack, I can't offer an elaborate explanation, but I found a fix for the issue.

In your ci/webpack.config.js, add the resolve section to the config and remove node_modules from the exclusion list for svelte-loader:

// ...

module.exports = {
  // ...
  // Taken from https://github.com/sveltejs/template-webpack/blob/master/webpack.config.js
  resolve: {
    alias: {
      svelte: path.dirname(require.resolve('svelte/package.json'))
    },
    extensions: ['.mjs', '.js', '.svelte'],
    mainFields: ['svelte', 'browser', 'module', 'main']
  },
  module: {
    rules: [
      {
        test: /\.svelte?$/,
        // exclude: [path.resolve(appPath, 'node_modules')],
        loader: 'svelte-loader',
        options: { ...svelteConfig }
      },
    ],
  },
  // ...
};

I've also noticed that your Webpack config differs quite a lot from the one suggested in the Svelte app template for Webpack, so if this is something you can change, I'd advise you to upgrade to Webpack 5 and make the config more similar to the template one. I just personally found it very useful to let Svelte devs resolve certain configuration issues and just copy from them :)

from attractions.

jcschmidig avatar jcschmidig commented on August 11, 2024

Thanks a lot for your quick and successful fix!
I can't upgrade to webpack 5 currently but will pursue the subject and follow recommendations.
Again, many thanks!

from attractions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.