aboutsummaryrefslogtreecommitdiff
path: root/webpack.config.js
diff options
context:
space:
mode:
authorNoah Loomans <noahloomans@gmail.com>2018-03-21 15:16:19 +0100
committerNoah Loomans <noahloomans@gmail.com>2018-03-21 15:16:19 +0100
commitd30e28bfaa692764823841d4f7ce97be2e365c44 (patch)
treee08137968471a0b588041b5758d93b299bfffa84 /webpack.config.js
parentadc3852aa50fb091fefec8dbfafcfdcec46e72c3 (diff)
Use css-loader with modules
Diffstat (limited to 'webpack.config.js')
-rw-r--r--webpack.config.js40
1 files changed, 15 insertions, 25 deletions
diff --git a/webpack.config.js b/webpack.config.js
index 0bf982a..573373c 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -1,8 +1,7 @@
const webpack = require('webpack');
const path = require('path');
-const ExtractTextPlugin = require('extract-text-webpack-plugin');
-const js = {
+module.exports = {
entry: './src/client/react/index.js',
output: {
path: path.resolve(__dirname, 'src/client/static'),
@@ -11,11 +10,24 @@ const js = {
module: {
rules: [
{
- test: [/\.js$/, /\.jsx$/],
+ test: /\.js$/,
exclude: [/node_modules/],
loader: 'babel-loader',
options: { presets: ['es2015', 'react', 'stage-2'] },
},
+ {
+ test: /\.css/,
+ use: [
+ { loader: 'style-loader' },
+ {
+ loader: 'css-loader',
+ options: {
+ modules: true,
+ localIdentName: '[local]--[name]--[hash:base64:5]',
+ },
+ },
+ ],
+ },
],
},
plugins: [
@@ -24,25 +36,3 @@ const js = {
new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /nl/),
],
};
-
-const style = {
- entry: './src/client/style/index.scss',
- output: {
- path: path.resolve(__dirname, 'src/client/static'),
- filename: 'bundle.css',
- },
- module: {
- rules: [
- {
- test: [/\.scss$/],
- exclude: [/node_modules/],
- loader: ExtractTextPlugin.extract(['css-loader', 'sass-loader']),
- },
- ],
- },
- plugins: [
- new ExtractTextPlugin('bundle.css'),
- ],
-};
-
-module.exports = [js, style];