-
Notifications
You must be signed in to change notification settings - Fork 5
/
next.config.js
57 lines (53 loc) · 1.6 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
const withLinaria = require("next-linaria");
/* eslint-disable */
module.exports = withLinaria({
images: {
disableStaticImages: true,
},
webpack(config, { dev, isServer }) {
config.module.rules.push({
test: /\.(glsl|vs|fs|vert|frag)$/,
exclude: /node_modules/,
use: [
"raw-loader",
{
loader: "glslify-loader",
options: {
// Transforms must also go into package.json, for when babel is handling inline glsl
transform: [["glslify-hex", { "option-1": true, "option-2": 42 }]],
},
},
],
});
config.module.rules.push({
test: /\.(obj|gltf|mtl)$/,
exclude: /node_modules/,
use: ["file-loader"],
});
config.module.rules.push({
test: /\.(png|jpeg|jpg)$/,
exclude: /node_modules/,
use: {
loader: "file-loader",
options: {
name: path => {
const isBundledWithSketch = path.match(/([0-9]{6})/);
if (isBundledWithSketch) {
const [basePath, sketchId, subPath] = path.split(/([0-9]{6})/);
const [_, relevantBasePath] = basePath.split("sketches/");
const filename = subPath.split("/").slice(-1);
const [subPathWithoutFilename] = subPath.split(`/${filename}`);
return `sketches/${relevantBasePath}/${
sketchId + subPathWithoutFilename
}/[name].[ext]`;
} else {
return "[name].[ext]";
}
},
outputPath: `static/images`,
},
},
});
return config;
},
});