Comments (6)
Thanks! I don't think mdx-go should have its own config – it would add to the API surface area and this is really a babel configuration issue. With the changes from babel 6 to 7, supporting custom babel configs for all use-cases is very tricky, but I'd consider allowing the babel-loader to pick up custom configs for v7 only. Would need to test this out and make sure it works first
from mdx-go.
Currently the webpack babel-loader is set to babelrc: false
to avoid unintentional conflicts. Have you tried with a custom webpack config? (Not sure if that would work right now, but it might)
from mdx-go.
My current solution is to copy and paste the necessary code from lib/config.js
and modify as I need:
// webpack.config.js
const path = require('path');
const babel = {
babelrc: false,
presets: [
[
require.resolve('@babel/preset-env'),
{ modules: false }
],
require.resolve('@babel/preset-react'),
],
plugins: [
require.resolve('@babel/plugin-proposal-class-properties'),
require.resolve('@babel/plugin-proposal-export-default-from'),
require.resolve('@babel/plugin-proposal-export-namespace-from'),
require.resolve('@babel/plugin-transform-runtime'),
require.resolve('@babel/plugin-syntax-dynamic-import'),
require.resolve('styled-jsx/babel'), // this is all I need for styled-jsx
]
}
module.exports = {
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: require.resolve('babel-loader'),
options: babel
}
}
],
},
resolve: { // I tried babel-plugin-module-resolver but this way is easier
alias: {
'components': path.resolve('./src/components'),
'utils': path.resolve('./src/utils'),
},
},
};
from mdx-go.
A better solution could be a mdx-go.config.js
file with custom and "secure" configs. As well as Next.js with next.config.js
: https://nextjs.org/docs#custom-configuration.
from mdx-go.
I just tested out a custom babel.config.js
locally with styled-jsx and it seemed to work with the latest version... I'm wondering if you've run into a bug somewhere, so it'd be helpful if you could test this out on your end.
In my babel.config.js
I have:
module.exports = {
plugins: [
'styled-jsx/babel'
]
}
Running [email protected] as a global install
from mdx-go.
Closing this out, but feel free to open a new issue if custom babel.config.js
files aren't working
from mdx-go.
Related Issues (20)
- Failed to compile, unexpected character '#' HOT 7
- Difference between mdx-go and x0 HOT 3
- Copy images to build folder HOT 4
- Upgrade to latest `mdx` version
- Static flag does not remove code split bundles HOT 2
- Typescript support? HOT 3
- ReferenceError: window is not defined when building HOT 2
- Ensure error overlay works
- Exporting custom path in md component does not work
- Is there a way to replace the template used in HTMLPlugin? HOT 2
- Custom File Match
- build --static still adds prefetch links to head HOT 1
- TOC links lead to .md domain instead of a sibling file HOT 1
- Compile to MD
- export 'DocsLayout' was not found in 'mdx-go'
- Themes HOT 4
- Deployment disabled on Now
- Support Sub-Resources URLs for images HOT 2
- Pagination cause `staticContext` react DOM warning
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 mdx-go.