How to use gatsby-1-config-extract-plugin - 2 common examples

To help you get started, we’ve selected a few gatsby-1-config-extract-plugin 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 gatsbyjs / gatsby / packages / gatsby / src / utils / webpack.config.js View on Github external
case `build-html`:
      case `develop-html`:
        // We don't deal with CSS at all when building the HTML.
        // The 'null' loader is used to prevent 'module not found' errors.
        // On the other hand CSS modules loaders are necessary.

        config.loader(`css`, {
          test: /\.css$/,
          exclude: /\.module\.css$/,
          loader: `null`,
        })

        // CSS modules
        config.loader(`cssModules`, {
          test: /\.module\.css$/,
          loader: extractTextPlugin(stage).extract(`style`, [
            cssModulesConfig(stage),
            `postcss`,
          ]),
        })

        return config

      case `build-javascript`:
        // we don't deal with css at all when building the javascript.  but
        // still need to process the css so offline-plugin knows about the
        // various assets referenced in your css.
        //
        // It's also necessary to process CSS Modules so your JS knows the
        // classNames to use.

        config.loader(`css`, {
github gatsbyjs / gatsby / packages / gatsby / src / utils / webpack.config.js View on Github external
})
              )
              return isFramework || count > 3
            },
          }),
          // Add a few global variables. Set NODE_ENV to production (enables
          // optimizations for React) and whether prefixing links is enabled
          // (__PREFIX_PATHS__) and what the link prefix is (__PATH_PREFIX__).
          new webpack.DefinePlugin({
            "process.env": processEnv(stage, `production`),
            __PREFIX_PATHS__: program.prefixPaths,
            __PATH_PREFIX__: JSON.stringify(store.getState().config.pathPrefix),
            __POLYFILL__: store.getState().config.polyfill,
          }),
          // Extract CSS so it doesn't get added to JS bundles.
          extractTextPlugin(stage),
          // Write out mapping between chunk names and their hashed names. We use
          // this to add the needed javascript files to each HTML page.
          new StatsWriterPlugin(),
          // Extract the webpack chunk manifest out of commons.js so commons.js
          // doesn't get changed everytime you build. This increases the cache-hit
          // rate for commons.js.
          new ChunkManifestPlugin({
            filename: `chunk-manifest.json`,
            manifestVariable: `webpackManifest`,
          }),
          // Ensure module order stays the same. Supposibly fixed in webpack 2.0.
          new webpack.optimize.OccurenceOrderPlugin(),
          new GatsbyModulePlugin(),
          // new WebpackStableModuleIdAndHash({ seed: 9, hashSize: 47 }),
          new HashedChunkIdsPlugin(),
        ]

gatsby-1-config-extract-plugin

extract-text-webpack-plugin instance getter for Gatsby v1 plugins

MIT
Latest version published 7 years ago

Package Health Score

66 / 100
Full package analysis

Popular gatsby-1-config-extract-plugin functions