-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
user survey: what are you doing in your modifyWebpackConfig? #432
Comments
In a nutshell:
https://github.com/cleverfranke/cf-kyt-starter-universal-redux/blob/master/kyt.config.js Slightly relevant, we've changed the serverURL for production environments (npm run start) so it runs on another port. This is to prevent caching issues. We're using ServiceWorkers in production builds and it's quite annoying if ServiceWorkers hijack your development environment. https://github.com/cleverfranke/cf-kyt-starter-universal-redux/blob/master/kyt.config.production.js |
// kyt.config.js
module.exports = {
reactHotLoader: true,
debug: false,
modifyWebpackConfig: (baseConfig, options) => {
baseConfig.module.rules.unshift({
test: /\.svg$/,
loaders: [
'babel-loader',
{
loader: 'react-svg',
query: {
es5: false,
jsx: true,
svgo: {
plugins: [{ removeTitle: false }],
floatPrecision: 2
}
}
}
]
});
baseConfig.module.rules[2].exclude = /\.svg$/;
return baseConfig;
},
modifyJestConfig: config => {
config.collectCoverageFrom = [
'**/*.{js,jsx}',
'!**/.storybook/**',
'!**/flowtyped/**',
'!**/*.story.js',
'!**/node_modules/**'
];
config.testResultsProcessor = '../node_modules/jest-junit';
return config;
}
}; And our {
"presets": [
"react-app"
],
"plugins": [
"dynamic-import-webpack",
[
"transform-define",
"./config.js"
]
]
} // config.js (local environment)
// We check the local version into git.
// This gets replaced by an Ansible task before builds.
module.exports = {
APP_VERSION: '0.0.1',
API_VERSION: 'v2.2',
API_URL: 'http://localhost:8080',
STAGE: 'local',
HTTPS: false,
S3_URL: 'https://XXXXXX.s3-website-us-east-1.amazonaws.com/',
WP_URL: 'https://XXXXXXXX.com',
GA: 'XXXXXXXXXX',
STRIPE_PUBLIC_KEY: 'XXXXXXXX',
CLIENT_PUBLIC_ID: 'XXXXX'
}; |
In
To make
|
No one mentioned file/font loaders yet. This is what currently is in my kyt.config.js:
(Trying to reliably avoid flash of unstyled text in modern browsers and ensure fast loading speeds. If there‘s just one font including it with other site’s assets as opposed to using a CDN seems to be worth it, still in the process of figuring it out though.) |
Found out this is needed when you want to run a starter kyt in a container (Docker in my case, but probably same is true for Vagrant). module.exports = {
reactHotLoader: true,
debug: false,
serverURL: 'http://0.0.0.0:3000',
clientURL: 'http://0.0.0.0:3001',
} |
Building a starter-kyt for a React, TypeScript, styled-components project. Working off of https://github.com/delambo/kyt-starter-universal-angular2 Currently having some issues because babel is not required with TS, but I'm still getting an
module.exports = {
reactHotLoader: false,
debug: true,
hasServer: false,
modifyWebpackConfig: (config, options) => {
config.resolve.extensions.push('.ts')
config.resolve.extensions.push('.tsx')
config.module.rules.push({
test: /\.tsx?$/,
exclude: [/\.(spec|e2e)\.tsx?$/, /node_modules/],
loaders: ['ts-loader']
})
return config
}
} |
Note: the changes below are not present in the latest release on NPM, but in the latest canary release 0.1.0-alpha.c0748b10. We use this in druid-kyt-starter (via druid-kyt-default-configuration to
|
I had to add code below to be able to use swaggergen-generated API classes (got the following error: "Module not found: Error Cannot resolve module")
|
I am adding graphql-tag loader and stage0 thank you! |
I'm using it the add the Workbox plugin. const WorkboxPlugin = require('workbox-webpack-plugin')
module.exports = {
debug: false,
modifyWebpackConfig: baseConfig => {
baseConfig.plugins.push(
new WorkboxPlugin.InjectManifest({
swSrc: './src/public/sw.js',
})
)
return baseConfig
},
} |
I'm using it to
|
As an attempt to build even better defaults into kyt, we're wondering what you're currently doing in your
modifyWebpackConfig
inkyt.config.js
. Please comment or leave thumbs on existing uses--we'll likely use the feedback here to set future priorities for kyt 😁 ✨The text was updated successfully, but these errors were encountered: