Import attributes tests
MDX, JSX and TSX files can use import attributes.
Modules imported with with {type: 'text'} should be the raw file content, not processed by any loader. These tests fail the build otherwise.
MDX fileβ
JSON importβ
{"fixture":"JSON fixture"}
β JS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function JsFixture() {
return <div>JS fixture</div>;
}
β TS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export const tsFixture: string = 'TS fixture';
β TSX
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function TsxFixture({name}: {name: string}): React.JSX.Element {
return <div>TSX fixture {name}</div>;
}
β JSON
{
"fixture": "JSON fixture"
}
β CSS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.cssFixture {
color: red;
}
β CSS Module
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.cssModuleFixture {
color: blue;
}
β SVG
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><circle cx="5" cy="5" r="4" /></svg>
β Markdown
# Markdown fixture
Some **Markdown** text.
β MDX
# MDX fixture
<MdxFixture name="world" />
β YAML
fixture: YAML fixture
β Text
Text fixture
JSX fileβ
JSON import
{"fixture":"JSON fixture"}β JS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function JsFixture() {
return <div>JS fixture</div>;
}
β TS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export const tsFixture: string = 'TS fixture';
β TSX
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function TsxFixture({name}: {name: string}): React.JSX.Element {
return <div>TSX fixture {name}</div>;
}
β JSON
{
"fixture": "JSON fixture"
}
β CSS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.cssFixture {
color: red;
}
β CSS Module
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.cssModuleFixture {
color: blue;
}
β SVG
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><circle cx="5" cy="5" r="4" /></svg>
β Markdown
# Markdown fixture
Some **Markdown** text.
β MDX
# MDX fixture
<MdxFixture name="world" />
β YAML
fixture: YAML fixture
β Text
Text fixture
TSX fileβ
JSON import
{"fixture":"JSON fixture"}β JS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function JsFixture() {
return <div>JS fixture</div>;
}
β TS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
export const tsFixture: string = 'TS fixture';
β TSX
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import React from 'react';
export default function TsxFixture({name}: {name: string}): React.JSX.Element {
return <div>TSX fixture {name}</div>;
}
β JSON
{
"fixture": "JSON fixture"
}
β CSS
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.cssFixture {
color: red;
}
β CSS Module
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
.cssModuleFixture {
color: blue;
}
β SVG
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10"><circle cx="5" cy="5" r="4" /></svg>
β Markdown
# Markdown fixture
Some **Markdown** text.
β MDX
# MDX fixture
<MdxFixture name="world" />
β YAML
fixture: YAML fixture
β Text
Text fixture