Skip to content
This repository was archived by the owner on Jun 5, 2019. It is now read-only.

Commit ed6a855

Browse files
committed
Adjusting image imports to support webpack.
1 parent b3b21a6 commit ed6a855

File tree

6 files changed

+20
-34
lines changed

6 files changed

+20
-34
lines changed

.storybook/webpack.config.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ const path = require('path')
22
const genDefaultConfig = require('@storybook/react/dist/server/config/defaults/webpack.config.js')
33

44
module.exports = (config, env) => {
5-
const myConfig = genDefaultConfig(config, env)
5+
const myConfig = genDefaultConfig(config, env)
66

7-
myConfig.module.rules.push({
8-
test: /\.tsx?$/,
9-
loader: 'ts-loader',
10-
exclude: /node_modules/,
11-
include: path.resolve(__dirname, '..', 'src')
12-
})
7+
myConfig.module.rules.push({
8+
test: /\.tsx?$/,
9+
loader: 'ts-loader',
10+
exclude: /node_modules/,
11+
include: path.resolve(__dirname, '..', 'src'),
12+
})
1313

14-
myConfig.resolve.extensions.unshift('.tsx')
15-
myConfig.resolve.extensions.unshift('.ts')
14+
myConfig.resolve.extensions.unshift('.tsx')
15+
myConfig.resolve.extensions.unshift('.ts')
1616

17-
return myConfig
17+
return myConfig
1818
}

fuse.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Sparky.task('default', ['copy-html'], () => {
4343
.bundle('renderer')
4444
.instructions('> [renderer/index.tsx] +fuse-box-css')
4545
.plugin(CSSPlugin())
46-
.plugin(CopyPlugin({ useDefault: true, files: ASSETS, dest: 'assets', resolve: 'assets/' }))
46+
.plugin(CopyPlugin({ useDefault: false, files: ASSETS, dest: 'assets', resolve: 'assets/' }))
4747

4848
// and watch & hot reload unless we're bundling for production
4949
if (!isProduction) {

src/renderer/features/example-using-tabs/fun-dog/fun-dog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as React from 'react'
22
import { CSSProperties } from 'react'
3-
import dogImage from './fun-dog.jpg'
3+
import * as dogImage from './fun-dog.jpg'
44
import { colors, SpinAnimation } from '../../../platform'
55
import { css } from 'glamor'
66

src/renderer/features/example-using-tabs/logo/logo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react'
22
import { CSSProperties } from 'react'
33
import { cssProps, animations } from '../../../platform'
4-
import icon from './electron-icon.svg'
4+
import * as icon from './electron-icon.svg'
55
import { css } from 'glamor'
66

77
const ROOT = css(

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"moduleResolution": "node",
66
"jsx": "react",
77
"experimentalDecorators": true,
8-
"allowSyntheticDefaultImports": true,
8+
"allowSyntheticDefaultImports": false,
99
"strict": true,
1010
"noUnusedLocals": true
1111
}

typings/images.d.ts

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
11
// Tell the TS compiler that it's ok to load these
2-
// types of extensions. FuseBox will do the right thing.
3-
declare module '*.jpeg' {
4-
export default ''
5-
}
6-
7-
declare module '*.jpg' {
8-
export default ''
9-
}
10-
11-
declare module '*.gif' {
12-
export default ''
13-
}
14-
15-
declare module '*.png' {
16-
export default ''
17-
}
18-
19-
declare module '*.svg' {
20-
export default ''
21-
}
2+
// types of extensions. FuseBox and webpack will do the right thing.
3+
declare module '*.jpeg'
4+
declare module '*.jpg'
5+
declare module '*.gif'
6+
declare module '*.png'
7+
declare module '*.svg'

0 commit comments

Comments
 (0)