@sidx1024 can you somehow explain on how to integrate your hack into a custom nextjs 13 app folder enabled app?
i read on how to enable a custom webpack config here: https://nextjs.org/docs/api-reference/next.config.js/custom-webpack-config
the code for the next.config.js
looks like that
module.exports = { webpack: ( config, { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack } ) => { // Important: return the modified config return config }, }
i am fairly new to webpack. do i have to add it in my next.config.js
like this?
const path = require('path') module.exports = { experimental: { appDir: true, }, output: 'standalone', webpack: ( config, { buildId, dev, isServer, defaultLoaders, nextRuntime, webpack } ) => { // console.log('------------------------------------------------------------'); // console.log('config', JSON.stringify(config.module.rules, null, 2)) // console.log('------------------------------------------------------------'); process.env.INSTRUMENT_CODE && console.log('enabled'); process.env.INSTRUMENT_CODE && config.module.rules.push({ test: /\.(ts|tsx)$/, include: [path.join(__dirname, 'assets')], exclude: /node_modules/, loader: 'babel-loader', options: { cacheDirectory: true, plugins: ['istanbul'], presets: [ [ '@babel/preset-env', { targets: { // Keep the babel target as modern as possible. // We're using babel-loader only for the istanbul plugin and not for any transformation. // Transformations are handled by swc-loader browsers: ['last 2 versions'], }, }, ], ], }, }) config.module.rules.push({ test: /\.(ts|tsx)$/, loader: 'swc-loader', options: { jsc: { transform: { react: { development: true, refresh: true, }, }, }, parseMap: Boolean(process.env.INSTRUMENT_CODE), }, include: [path.join(__dirname, 'assets')], exclude: /node_modules/, }) return config }, }
i defined the dev script like this INSTRUMENT_CODE=1 NODE_ENV=development PORT=${TPL_WS_NEXTJS_PORT} next dev
and can see, that enabled
is printed out when running yarn dev. when opening the website and trying window.__coverage__
nothing is shown.
do i have to somehow adapt this for a typescript nextjs project. thats what i use.
thx for posting your hack! i hope, i can somehow get it running!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4