| 1 | /** |
| 2 | * Copyright (c) Meta Platforms, Inc. and affiliates. |
| 3 | * |
| 4 | * This source code is licensed under the MIT license found in the |
| 5 | * LICENSE file in the root directory of this source tree. |
| 6 | */ |
| 7 | |
| 8 | const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin'); |
| 9 | const path = require('path'); |
| 10 | |
| 11 | const nextConfig = { |
| 12 | experimental: { |
| 13 | reactCompiler: true, |
| 14 | viewTransition: true, |
| 15 | }, |
| 16 | reactStrictMode: true, |
| 17 | webpack: (config, options) => { |
| 18 | // Load *.d.ts files as strings using https://webpack.js.org/guides/asset-modules/#source-assets. |
| 19 | config.module.rules.push({ |
| 20 | test: /\.d\.ts/, |
| 21 | type: 'asset/source', |
| 22 | }); |
| 23 | |
| 24 | // Monaco Editor |
| 25 | if (!options.isServer) { |
| 26 | config.plugins.push( |
| 27 | new MonacoWebpackPlugin({ |
| 28 | languages: ['typescript', 'javascript'], |
| 29 | filename: 'static/[name].worker.js', |
| 30 | }) |
| 31 | ); |
| 32 | } |
| 33 | |
| 34 | config.resolve.alias = { |
| 35 | ...config.resolve.alias, |
| 36 | 'react-compiler-runtime': path.resolve( |
| 37 | __dirname, |
| 38 | '../../packages/react-compiler-runtime' |
| 39 | ), |
| 40 | }; |
| 41 | config.resolve.fallback = { |
| 42 | fs: false, |
| 43 | path: false, |
| 44 | os: false, |
| 45 | }; |
| 46 | |
| 47 | return config; |
| 48 | }, |
| 49 | |
| 50 | transpilePackages: ['monaco-editor'], |
| 51 | }; |
| 52 | |
| 53 | module.exports = nextConfig; |