-
-
Save Timer/2ed585ff0db6b885a7f7dd738a982b13 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
"monaco-editor" | |
]); | |
module.exports = withTM({ | |
webpack(config) { | |
const rule = config.module.rules | |
.find(rule => rule.oneOf) | |
.oneOf.find( | |
r => | |
// Find the global CSS loader | |
r.issuer && r.issuer.include && r.issuer.include.includes("_app") | |
); | |
if (rule) { | |
rule.issuer.include = [ | |
rule.issuer.include, | |
// Allow `monaco-editor` to import global CSS: | |
/[\\/]node_modules[\\/]monaco-editor[\\/]/ | |
]; | |
} | |
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
After modified the code like above, the module.css file don't work anymore, how can I make module.css work?