|
21 | 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
22 | 22 | * SOFTWARE. |
23 | 23 | */ |
24 | | -import path from 'path' |
25 | | -import { fileURLToPath } from 'url' |
26 | | -import fs from 'fs' |
27 | | - |
28 | | -const __filename = fileURLToPath(import.meta.url) |
29 | | -const __dirname = path.dirname(__filename) |
30 | | - |
31 | | -// Generate aliases for all @instructure/* workspace packages |
32 | | -function getWorkspaceAliases() { |
33 | | - const packagesDir = path.resolve(__dirname, '../packages') |
34 | | - const packages = fs.readdirSync(packagesDir) |
35 | | - const aliases = {} |
36 | | - |
37 | | - packages.forEach(pkg => { |
38 | | - const pkgPath = path.join(packagesDir, pkg) |
39 | | - if (fs.statSync(pkgPath).isDirectory()) { |
40 | | - const pkgJsonPath = path.join(pkgPath, 'package.json') |
41 | | - if (fs.existsSync(pkgJsonPath)) { |
42 | | - const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8')) |
43 | | - const pkgName = pkgJson.name |
44 | | - if (pkgName && pkgName.startsWith('@instructure/')) { |
45 | | - // Alias package to its built es modules |
46 | | - aliases[pkgName] = path.join(pkgPath, 'es') |
47 | | - // Also alias /es/index paths |
48 | | - aliases[`${pkgName}/es`] = path.join(pkgPath, 'es') |
49 | | - } |
50 | | - } |
51 | | - } |
52 | | - }) |
53 | | - |
54 | | - return aliases |
55 | | -} |
56 | 24 |
|
57 | 25 | /** @type {import('next').NextConfig} */ |
58 | 26 | const nextConfig = { |
59 | 27 | // strict mode needs to be disabled, so deterministic ID generation |
60 | 28 | // works. If its enabled, client side double rendering causes IDs to |
61 | 29 | // come out of sync. TODO fix |
62 | | - reactStrictMode: false, |
63 | | - |
64 | | - webpack: (config) => { |
65 | | - // Add aliases for workspace packages |
66 | | - config.resolve.alias = { |
67 | | - ...config.resolve.alias, |
68 | | - ...getWorkspaceAliases() |
69 | | - } |
70 | | - return config |
71 | | - } |
| 30 | + reactStrictMode: false |
72 | 31 | } |
73 | 32 |
|
74 | 33 | export default nextConfig |
0 commit comments