g6/gatsby-node.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

2020-07-21 14:11:39 +08:00
const path = require('path');
2020-11-21 11:56:53 +08:00
const StaticSiteGeneratorPlugin = require('static-site-generator-webpack-plugin');
exports.onCreateWebpackConfig = ({ getConfig, actions }) => {
2020-07-21 14:11:39 +08:00
const config = getConfig();
config.module.rules.push({
test: /\.glsl$/,
use: [
{
loader: 'raw-loader',
options: {
esModule: false,
},
},
],
});
config.module.rules.push({
test: /\.worker\.ts$/,
use: {
loader: 'worker-loader',
},
});
config.resolve.extensions.push('.glsl');
config.resolve.alias = {
...config.resolve.alias,
'https://cdn.jsdelivr.net/npm/@webgpu/glslang@0.0.15/dist/web-devel/glslang.js': path.resolve(__dirname, 'stub')
};
2020-11-21 11:56:53 +08:00
actions.setWebpackConfig({
plugins: [
new StaticSiteGeneratorPlugin({
globals: {
window: {}
}
}),
],
});
2020-07-21 14:11:39 +08:00
};