JSPM

@sanity/webpack-integration

1.148.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 5374
  • Score
    100M100P100Q121486F
  • License MIT

Tools and modules required for making partisan (the part system) work with webpack

Package Exports

  • @sanity/webpack-integration
  • @sanity/webpack-integration/v3

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sanity/webpack-integration) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@sanity/webpack-integration

Tools and modules required for making partisan (the part system) work with webpack. Note: currently only works with Webpack 1.

Installing

npm install --save @sanity/webpack-integration

Usage

const sanityWebpack = require('@sanity/webpack-integration/v1')
const options = {
  basePath: '/path/to/project',
  env: 'production'
}

// Get array of plugins required for part loading
sanityWebpack.getPlugins(options)

// Get array of loader definitions required for part loading
sanityWebpack.getLoaders(options)

// Get array of postcss plugins required to build the CSS used in Sanity
sanityWebpack.getPostcssPlugins(options)

// Get a partial webpack configuration for the Sanity-specific parts. You'll have to merge this with your existing webpack config.
sanityWebpack.getConfig(options)



// Less common, but if you need more fine-grained access to internals:

// Get a preconfigured `DefinePlugin` that exposes `__DEV__`
sanityWebpack.getEnvPlugin(options)

// Get the part resolver plugin required for part imports
sanityWebpack.getPartResolverPlugin(options)

// Get the part loader (requires the PartResolverPlugin)
sanityWebpack.getPartLoader(options)

// Get the resolving function required for postcss-import
sanityWebpack.getStyleResolver(options)

// Get an initialized postcss-import plugin
sanityWebpack.getPostcssImportPlugin(options)

License

MIT-licensed. See LICENSE.