Skip to content

Instantly share code, notes, and snippets.

@Timer Timer/next.config.js Secret
Created Mar 29, 2020

What would you like to do?
const MonacoWebpackPlugin = require("monaco-editor-webpack-plugin");
const withTM = require("next-transpile-modules")([
// `monaco-editor` isn't published to npm correctly: it includes both CSS
// imports and non-Node friendly syntax, so it needs to be compiled.
module.exports = withTM({
webpack(config) {
const rule = config.module.rules
.find(rule => rule.oneOf)
r =>
// Find the global CSS loader
r.issuer && r.issuer.include && r.issuer.include.includes("_app")
if (rule) {
rule.issuer.include = [
// Allow `monaco-editor` to import global CSS:
config.plugins.push(new MonacoWebpackPlugin({ languages: ["javascript"] }));
return config;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.