Skip to content
Snippets Groups Projects
Commit 3cf68d46 authored by Alf Eaton's avatar Alf Eaton
Browse files

Standardise webpack configs

Move webpack configs to a single location, in xpub-styleguide.
Use localIdentName to add module and original class names to the class name.
parent 4cf2d9fd
No related branches found
No related tags found
No related merge requests found
...@@ -8,7 +8,6 @@ module.exports = { ...@@ -8,7 +8,6 @@ module.exports = {
faker: 'faker', faker: 'faker',
}, },
skipComponentsWithoutExample: true, skipComponentsWithoutExample: true,
webpackConfig: require('./webpack.config.js'),
theme: { theme: {
fontFamily: { fontFamily: {
base: '"Fira Sans", sans-serif' base: '"Fira Sans", sans-serif'
......
process.env.BABEL_ENV = 'development' const webpackConfig = require('xpub-styleguide/src/webpack-config')
process.env.NODE_ENV = 'development'
const path = require('path') module.exports = webpackConfig(__dirname)
const nodeExternals = require('webpack-node-externals')
const include = [
path.join(__dirname, 'src'),
/xpub-[^/]+\/src/,
]
module.exports = {
entry: './src/index.js',
output: {
filename: 'index.js',
path: path.join(__dirname, 'dist')
},
devtool: 'cheap-module-source-map',
externals: [nodeExternals({
whitelist: [/\.(?!js$).{1,5}$/i]
})],
resolve: {
symlinks: false
},
module: {
rules: [
{
oneOf: [
// ES6 modules
{
test: /\.js$/,
include,
loader: 'babel-loader',
options: {
presets: [
['env', { modules: false }],
'react',
'stage-2'
],
cacheDirectory: true,
},
},
// CSS modules
{
test: /\.local\.css$/,
include,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
}
}
],
},
// SCSS modules
{
test: /\.local\.scss$/,
include,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
modules: true,
importLoaders: 1
}
},
'sass-loader'
],
},
// global CSS
{
test: /\.css$/,
use: [
'style-loader',
'css-loader'
],
},
// global SCSS
{
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1
}
},
'sass-loader'
],
},
// Files
{
exclude: [/\.js$/, /\.html$/, /\.json$/],
loader: 'file-loader',
options: {
name: 'static/media/[name].[hash:8].[ext]',
}
}
]
}
]
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment