Created
April 14, 2018 14:05
-
-
Save andrewMuntyan/4d68d3dd3706f74d5eb0f587105aa2c5 to your computer and use it in GitHub Desktop.
import images #12 https://github.com/Microsoft/TypeScript-React-Starter/issues/12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const result = { | |
module: { | |
rules: [ | |
{ | |
test: /\.tsx?$/, | |
exclude: /node_modules/, | |
use: [ | |
{ | |
loader: 'babel-loader', | |
options: { | |
babelrc: true, | |
plugins: ['react-hot-loader/babel'] | |
} | |
}, | |
{ | |
loader: 'ts-loader', | |
options: { | |
configFile: path.resolve(configDir, 'tsconfig.json') | |
} | |
} | |
] | |
}, | |
{ | |
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/, | |
loader: 'url-loader', | |
options: { | |
limit: 10000 | |
} | |
}, | |
] | |
}, | |
output: { | |
filename: '[name].bundle.js', | |
path: distDir | |
}, | |
plugins: [...], | |
resolve: { | |
modules: [srcDir, nodeModulesDir], | |
extensions: ['.tsx', '.ts', '.js', '.jsx'] | |
}, | |
}; | |
module.exports = result; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.large-image { | |
&--bg { | |
composes: large-image; | |
background: url('./large-image.jpg'); | |
background-size: 100px 100px; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare module "*.jpg" { | |
const value: string; | |
export default value; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import * as styles from './cssModules.css'; | |
import image from './large-image.jpg'; | |
console.log('----------'); | |
console.log('image'); | |
console.log(image); | |
console.log('----------'); | |
export default class CssModules extends React.Component<{}, {}> { | |
render() { | |
return ( | |
<section className={styles.root}> | |
<div className={styles.largeImageBg} /> | |
<img className={styles.largeImageImage} src={image} alt="" /> | |
</section> | |
); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"compilerOptions": { | |
"outDir": "../dist/", | |
"noImplicitAny": true, | |
"noImplicitReturns": true, | |
"noImplicitThis": true, | |
"sourceMap": true, | |
"module": "commonjs", | |
"target": "es6", | |
"jsx": "react", | |
"allowJs": true, | |
"strictNullChecks": true, | |
"typeRoots": [ | |
"../typings", | |
"../node_modules/@types" | |
] | |
}, | |
"include": [ | |
"../src/**/*", | |
"../typings/**/*" | |
], | |
"exclude": [ | |
"../node_modules", | |
"**/*.spec.ts" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment