-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext.config.js
36 lines (34 loc) · 1012 Bytes
/
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
const webpack = require('webpack')
require('dotenv').config()
module.exports = {
webpack: (config, { dev }) => {
config.module.rules.push(
{
test: /\.(css|scss)/,
loader: 'emit-file-loader',
options: {
name: 'dist/[path][name].[ext]'
}
},
{
test: /\.css$/,
loader: 'babel-loader!raw-loader'
},
{
test: /\.scss$/,
loader: 'babel-loader!raw-loader!sass-loader'
}
)
config.plugins.push(
// If you want to export an environent variable from the server to the
// client (so that you can write isomorphoic code), this is how you can
// do that with webpack. Note we use dotenv module to import environment
// variables configured in .env. This can be useful for setting options
// for things like API URL hostnames.
new webpack.DefinePlugin({
'process.env.MY_ENV_VAR': JSON.stringify(process.env.MY_ENV_VAR)
})
)
return config
}
}