spee.ch/webpack.config.js

56 lines
1.3 KiB
JavaScript
Raw Normal View History

2018-08-01 01:01:16 +02:00
const Path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const createModuleAliases = require('./utils/createModuleAliases.js');
const SCSS_ROOT = Path.join(__dirname, 'client/scss/');
2018-12-03 22:32:57 +01:00
const CLIENT_ROOT = Path.join(__dirname, 'client/');
const CUSTOM_CLIENT_ROOT = Path.join(__dirname, 'site/custom/');
2018-08-01 01:01:16 +02:00
const customAliases = createModuleAliases();
module.exports = {
target: 'web',
entry : ['@babel/polyfill', 'whatwg-fetch', './client/build/index.js'],
2018-08-01 01:01:16 +02:00
output: {
path : Path.join(__dirname, 'public/bundle'),
publicPath: '/bundle/',
filename : 'bundle.js',
},
module: {
rules: [
{
test: /\.scss$/,
use : ExtractTextPlugin.extract({
fallback: 'style-loader',
use : ['css-loader', 'sass-loader'],
}),
},
{
test: /\.(png|jpg|gif|otf|ttf|svg)$/,
use : [
{
loader : 'url-loader',
options: {
limit: 8192,
name : '[name]-[hash].[ext]',
},
},
],
},
],
},
resolve: {
modules: [
2018-12-03 22:32:57 +01:00
CUSTOM_CLIENT_ROOT,
CLIENT_ROOT,
2018-08-01 01:01:16 +02:00
SCSS_ROOT,
'node_modules',
__dirname,
],
alias : customAliases,
extensions: ['.js', '.jsx', '.scss'],
},
plugins: [
new ExtractTextPlugin('style.css'),
],
};