-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
66 lines (61 loc) · 1.89 KB
/
next.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
const path = require('path');
require('dotenv').config();
const ExtractTextPlugin = require("extract-text-webpack-plugin");
// const commonsChunkConfig = require('@zeit/next-css/commons-chunk-config');
const webpack = require('webpack');
const dev = process.env.NODE_ENV !== 'production';
const extractCSSPlugin = new ExtractTextPlugin({
filename: 'static/style.css'
});
module.exports = {
assetPrefix: dev ? '/' : '/nfl/gameday/',
webpack(config, { dev }) {
config.plugins.push(extractCSSPlugin);
config.plugins.push(
new webpack.EnvironmentPlugin(process.env)
);
config.module.rules.push({
test: /\.(css|scss)$/,
rules: [
// Process external/third-party styles
{
exclude: [path.resolve(__dirname, 'components'), path.resolve(__dirname, 'pages')],
use: extractCSSPlugin.extract(
[
{
loader: 'css-loader',
options: {
sourceMap: dev,
},
},
'sass-loader'
]
),
},
// Process internal/project styles (from src folder)
{
include: [path.resolve(__dirname, 'components'), path.resolve(__dirname, 'pages')],
use: extractCSSPlugin.extract(
[
{
loader: 'css-loader',
options: {
// CSS Loader https://github.com/webpack/css-loader
importLoaders: 1,
sourceMap: dev,
// CSS Modules https://github.com/css-modules/css-modules
modules: true,
localIdentName: dev
? '[name]-[local]-[hash:base64:5]'
: '[hash:base64:5]',
},
},
'sass-loader'
],
)
},
],
});
return config;
}
};