-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathnext.config.js
More file actions
30 lines (26 loc) · 1.35 KB
/
Copy pathnext.config.js
File metadata and controls
30 lines (26 loc) · 1.35 KB
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
const path = require("path");
const process = require("process");
const CopyPlugin = require("copy-webpack-plugin");
const pathBuilder = (subpath) => path.join(process.cwd(), subpath);
const nextConfig = {
reactStrictMode: true,
webpack: (config, { webpack }) => {
config.resolve.alias["@/data"] = pathBuilder("data");
config.resolve.alias["@/utils"] = pathBuilder("utils");
config.resolve.alias["@/styles"] = pathBuilder("styles");
config.resolve.alias["@/store"] = pathBuilder("store");
config.resolve.alias["@/components"] = pathBuilder("components");
config.resolve.alias["@/cesiumSource"] = pathBuilder("node_modules/cesium/Source");
config.output["sourcePrefix"] = "";
// Copy assets needed by Cesium to public folder so that they can be easily accessed.
// * "to" path is relative to the path in "from"
config.plugins.push(
new CopyPlugin({patterns: [{ from: pathBuilder("node_modules/cesium/Build/Cesium/Workers"), to: "../public/Workers" }]}),
new CopyPlugin({patterns: [{ from: pathBuilder("node_modules/cesium/Source/Assets"), to: "../public/Assets" }]}),
new CopyPlugin({patterns: [{ from: pathBuilder("node_modules/cesium/Source/Widgets"), to: "../public/Widgets" }]}),
new webpack.DefinePlugin({CESIUM_BASE_URL: JSON.stringify("/")})
);
return config;
}
};
module.exports = nextConfig;