UNPKG

gatsby-plugin-workerize-loader

Version:
32 lines (28 loc) 551 B
"use strict"; const { PREFIX } = require('./constants'); exports.onCreateWebpackConfig = ({ actions: { replaceWebpackConfig }, getConfig, stage }) => { const config = getConfig(); let options = {}; if (stage === 'build-javascript') { options = { name: `${PREFIX}-[1].[contenthash]`, regExp: '(\\w+).worker.(js|ts|coffee)$' }; } config.module.rules.push({ test: /\.worker\.(js|ts|coffee)$/, use: { loader: 'workerize-loader-wp5', options } }); replaceWebpackConfig(config); };