How to use the styled-jsx/webpack.loader function in styled-jsx

To help you get started, we’ve selected a few styled-jsx examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / next.js / examples / blog-starter / next.config.js View on Github external
webpack: (config, { defaultLoaders, isServer, dev }) => {
    // Fixes npm packages that depend on `fs` module
    config.node = {
      fs: 'empty',
      module: 'empty',
    }

    config.module.rules.push(
      {
        test: /\.css$/,
        use: [
          defaultLoaders.babel,
          {
            loader: require('styled-jsx/webpack').loader,
            options: {
              type: 'global',
            },
          },
        ],
      },
      {
        test: /\.svg$/,
        use: [
          {
            loader: '@svgr/webpack',
          },
        ],
      }
    )
github j0lv3r4 / jolvera.dev / next.config.js View on Github external
webpack: (config, { defaultLoaders, isServer, dev }) => {
    // Fixes npm packages that depend on `fs` module
    config.node = {
      fs: "empty",
      module: "empty"
    };

    config.module.rules.push(
      {
        test: /\.css$/,
        use: [
          defaultLoaders.babel,
          {
            loader: require("styled-jsx/webpack").loader,
            options: {
              type: "global"
            }
          }
        ]
      },
      {
        test: /\.svg$/,
        use: [
          {
            loader: "@svgr/webpack"
          }
        ]
      }
    );
github zeit / next.js / examples / with-external-styled-jsx-sass / next.config.js View on Github external
webpack: (config, { defaultLoaders }) => {
    config.module.rules.push({
      test: /\.scss$/,
      use: [
        defaultLoaders.babel,
        {
          loader: require('styled-jsx/webpack').loader,
          options: {
            type: 'scoped',
          },
        },
        'sass-loader',
      ],
    })

    return config
  },
}
github revskill10 / next-template / configs / webpack.config.js View on Github external
use: {
      loader: 'url-loader',
      options: {
        limit: 8192,
        publicPath: './',
        outputPath: 'static/css/',
        name: '[name].[ext]'
      }
    }
  })
  config.module.rules.push({
    test: /\.styles$/,
    use: [
      defaultLoaders.babel,
      {
        loader: require('styled-jsx/webpack').loader,
        options: {
          type: 'scoped'
        }
      }
    ]
  })

  if (config.mode === 'production') {
    if (Array.isArray(config.optimization.minimizer)) {
      config.optimization.minimizer.push(new OptimizeCSSAssetsPlugin({}));
    }
  }

  if (options.isServer) config.plugins.push(new ForkTsCheckerWebpackPlugin())
  config.output.webassemblyModuleFilename = 'static/wasm/[modulehash].wasm'
  return config
github madebywild / wild-next / next.config.js View on Github external
{
          loader: "emit-file-loader",
          options: {
            name: "dist/[path][name].[ext]",
          },
        },
        "babel-loader",
        "webpack-glsl-loader",
      ],
    });
    config.module.rules.push({
      test: /\.s([ac])ss$/,
      use: [
        options.defaultLoaders.babel,
        {
          loader: styledJsxLoader.loader,
          options: {
            type: fileName => fileName.toLowerCase().indexOf("global") === -1 ? "scoped" : "global",
          },
        },
        {
          loader: "sass-loader",
          options: {
            includePaths: [
              "./",
            ],
          },
        },
        {
          loader: "sass-resources-loader",
          options: {
            sourceMap: true,

styled-jsx

Full CSS support for JSX without compromises

MIT
Latest version published 6 months ago

Package Health Score

83 / 100
Full package analysis