Replies: 2 comments 5 replies
-
Should work in turbo:
|
Beta Was this translation helpful? Give feedback.
5 replies
-
Here's how I do my config. I use webpack for production and turbo for dev: import { withSentryConfig, SentryBuildOptions } from '@sentry/nextjs';
import type { NextConfig } from 'next';
import { merge } from 'lodash-es';
const USE_SENTRY = process.env.NEXT_PUBLIC_USE_SENTRY === 'true';
const images: NextConfig['images'] = {
remotePatterns: [
{
protocol: 'http',
hostname: 'localhost',
port: '',
pathname: '/**',
},
{
protocol: 'https',
hostname: 'i.pravatar.cc',
port: '',
pathname: '/**',
},
],
};
const config = (): NextConfig => {
const isDev = process.env.NODE_ENV === 'development';
const commonConfig: NextConfig = {
staticPageGenerationTimeout: 120,
reactStrictMode: true,
images,
sassOptions: {
silenceDeprecations: ['legacy-js-api'],
},
experimental: {
reactCompiler: true,
},
};
const devConfigTurbo: NextConfig = {
experimental: {
turbo: {
rules: {
'*.html': {
loaders: ['raw-loader'],
as: '*.js',
},
'*.md': {
loaders: ['raw-loader'],
as: '*.js',
},
},
},
},
};
const prodConfig: NextConfig = {
webpack: config => {
config.module.rules.push({
test: /\.(md|txt|html)$/i,
loader: 'raw-loader',
});
return config;
},
};
const config = merge({}, commonConfig, isDev ? devConfigTurbo : prodConfig);
return config;
};
const sentryConfig: SentryBuildOptions = {
org: 'example',
project: 'example',
sentryUrl: 'https://example.com',
silent: !process.env.CI,
widenClientFileUpload: true,
reactComponentAnnotation: {
enabled: true,
},
hideSourceMaps: true,
disableLogger: true,
automaticVercelMonitors: true,
};
const useConfig = USE_SENTRY ? withSentryConfig(config(), sentryConfig) : config();
export default useConfig; Then you need to declare each file extension you want to import as a global module: declare module '*.svg' {
const content: string;
export default content;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
I have installed raw-loader and it just working fine with webpack(both dev and build). But when I add --turbo flag to dev command, it cannot load the raw-loader.
Additional information
Installed the package as devDependency.
Added ts declaration
then import as
import styles from '!!raw-loader!~/styles/builder.css';
It works in webpack but not in turbo
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions