Comments (3)
My current workaround is to add this to gatsby-node.js
:
const path = require('path')
const extractQueryPlugin = path.resolve(
__dirname,
`node_modules/gatsby/dist/utils/babel-plugin-extract-graphql.js`
)
exports.modifyWebpackConfig = ({ config, stage }) => {
if (stage === 'build-javascript') {
// Temporary workaround.
// Here we override the Webpack plugin during the `build-javascript` stage to make everything
// compile down to es5 - turns out Webpack 1's UglifyJsPlugin doesn't like that we have some
// ES6 stuff littered in our final bundle...
config.loader('typescript', {
test: /\.tsx?$/,
loaders: [
`babel-loader?${JSON.stringify({ presets: ['babel-preset-env'], plugins: [extractQueryPlugin] })}`,
'ts-loader'
]
})
}
}
from gatsby-starter.
Interesting! No reason, it's a real bug 😉 I will try to check this tomorrow!
from gatsby-starter.
@fabien0102 Hey, this happens to me as well - I'm not using this starter kit, since I have my own, TypeScript-based setup, but it seems like it's a common issue among TypeScript at the moment.
My current hunch is that there's something that prevents gatsby-plugin-typescript
to be perfectly chained with Webpack's UglifyJS plugin, so many files come out unminified (see also: gatsbyjs/gatsby#2771)
Here's an example of the output bundle that Gatsby generates. If you have some ES6 stuff like this, Webpack 1's UglifyJsPlugin
will run into problems when trying to minify.
from gatsby-starter.
Related Issues (20)
- Cannot read tags group. HOT 4
- Create branch for Gatsby v2 HOT 12
- There are conflicting field types in your data. GraphQL schema will omit those fields. HOT 1
- Tags-Page.tsx template and blog.tsx page - corner case HOT 1
- Next branch error eslint-config-react-app missing HOT 3
- error GraphQL Error Unknown field `responsiveResolution` on type `ImageSharp` HOT 2
- how to remove disqus comment section with facebook comments
- what goes in siteMetaData googleVerification HOT 2
- Move `next` to `master`, move current `master` to `v1` HOT 2
- Repo description still says V1 instead of V2 HOT 1
- gatsby-browser and gatsby-ssr need to be Javascript HOT 1
- Allot of vulnerabilities in this repo HOT 2
- Styles from styled components not loading in production, SSR issue?
- Not work with node v11.11.0 && npm v6.7.0 && gatsby v2.4.10 HOT 1
- npm ERR! notarget No matching version found for gatsby@next HOT 3
- License? HOT 1
- Create a new site fails HOT 2
- [Suggestion] replace storybook-readme with Docs Addon HOT 1
- [Idea][Feature Request] Netlify CMS?
- Creating or overriding semantic-ui themes HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby-starter.