It would be reasonable to assume the packages @babel/plugin-transform-react-jsx and @babel/plugin-transform-react-jsx-source indicate that immutable styles is coupled to React. Don't let the package names fool you! These packages enable immutable styles to use JSX and nothing more. Immutable styles is markup agnostic – meaning it isn’t coupled or biased to a specific way of generating HTML.
Configure Plugin
In webpack.config.js add the ImmutableStylesWebpackPlugin:
var { ImmutableStylesWebpackPlugin } =require('immutable-styles');module.exports= { plugins: [newImmutableStylesWebpackPlugin() ]}
Then enable source-maps and set nodes fs module to empty:
Note on Source Maps
Source maps are required for compile-time errors. If source maps are not enabled the error Missing Source Maps will be thrown.
By default the CSS generated by immutable styles is located in dist/bundle.css. This can be optionally configured when initialising the plugin:
Then make sure the immutable style sheets are passed through babel-loader:
And lastly in .babelrc register the following presets and plugins:
Examples
Some examples of using immutable styles with Webpack can be found in the following repos: