Need help in deploying a webpack project on codesandbox.io

I am trying to deploy my project which uses webpack on codesandbox.io, but it doesn’t seem to deploy correctly. I have already tried moving all devDependencies object to dependencies object in package.json. I also tried rendering css file through html file instead of through javascript. Here is the link.

You don’t need to specify the implementation option unless you are choosing some other form of sass package. Normally you don’t need it and it will use whatever you specified in the devDependencies. I am not sure you needed to move everything from devDependencies to dependencies. Normally you have devDependencies for everything you use while developing and are not deployed. Sass would be one of those dev dependencies because you convert from scss to css prior to deployment as a development task.

I think you are following sass-loader webpack page here… https://webpack.js.org/loaders/sass-loader/

So just follow the earlier example on that page…

module: {
    rules: [
      {
        test: /\.s[ac]ss$/i,
        use: [
          // Creates `style` nodes from JS strings
          "style-loader",
          // Translates CSS into CommonJS
          "css-loader",
          // Compiles Sass to CSS
          "sass-loader",
        ],
      },
    ],
  }

Oh and if you can, make sure those dev dependencies are back in the right spot. :slight_smile:

1 Like

Tried this but it doesn’t seem to work on codesandbox, but it does work locally.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.