Skip to content

Commit

Permalink
Merge pull request #11936 from blake-newman/patch-1
Browse files Browse the repository at this point in the history
Vue: Add support for tsx
  • Loading branch information
shilman committed Jul 19, 2021
2 parents 67ab465 + 618fc1c commit 1932d62
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
10 changes: 5 additions & 5 deletions addons/docs/src/frameworks/react/jsxDecorator.tsx
Expand Up @@ -118,11 +118,11 @@ export const renderJsx = (code: React.ReactElement, options: JSXOptions) => {

if (string.indexOf('"') > -1) {
const matches = string.match(/\S+=\\"([^"]*)\\"/g);
if (matches) {
matches.forEach((match) => {
string = string.replace(match, match.replace(/"/g, "'"));
});
}
if (matches) {
matches.forEach((match) => {
string = string.replace(match, match.replace(/"/g, "'"));
});
}
}

return string;
Expand Down
14 changes: 13 additions & 1 deletion app/vue/src/server/framework-preset-vue.ts
Expand Up @@ -14,7 +14,7 @@ export async function webpack(config: Configuration, { presets }: Options) {
options: {},
});
config.module.rules.push({
test: /\.tsx?$/,
test: /\.ts$/,
use: [
{
loader: require.resolve('ts-loader'),
Expand All @@ -25,6 +25,18 @@ export async function webpack(config: Configuration, { presets }: Options) {
},
],
});
config.module.rules.push({
test: /\.tsx$/,
use: [
{
loader: require.resolve('ts-loader'),
options: {
transpileOnly: true,
appendTsxSuffixTo: [/\.vue$/],
},
},
],
});

config.resolve.extensions.push('.vue');
config.resolve.alias = { ...config.resolve.alias, vue$: require.resolve('vue/dist/vue.esm.js') };
Expand Down
2 changes: 1 addition & 1 deletion lib/components/src/blocks/ColorPalette.tsx
Expand Up @@ -81,7 +81,7 @@ const SwatchColors = styled.div(({ theme }) => ({
overflow: 'hidden',
backgroundColor: 'white',
backgroundImage: `repeating-linear-gradient(-45deg, #ccc, #ccc 1px, #fff 1px, #fff 16px)`,
backgroundClip: 'padding-box'
backgroundClip: 'padding-box',
}));

const SwatchSpecimen = styled.div({
Expand Down

0 comments on commit 1932d62

Please sign in to comment.