Skip to content

Commit f72fead

Browse files
author
Kent C. Dodds
committed
moduleDirectories example
1 parent a103c9b commit f72fead

11 files changed

+5
-1
lines changed

src/calculator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import styles from './calculator.module.css'
88
// splitting in this example because it's something you have to
99
// handle with Jest and many people will want to know :).
1010
const CalculatorDisplay = loadable({
11-
loader: () => import('./calculator-display').then(mod => mod.default),
11+
loader: () => import('calculator-display').then(mod => mod.default),
1212
loading: () => <div style={{height: 120}}>Loading display...</div>,
1313
})
1414

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

test/jest-common.js

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const path = require('path')
55
module.exports = {
66
rootDir: path.join(__dirname, '..'),
77
moduleFileExtensions: ['js', 'json', 'jsx', 'node', 'css'],
8+
moduleDirectories: ['node_modules', path.join(__dirname, 'src'), 'shared'],
89
moduleNameMapper: {
910
// module must come first
1011
'\\.module\\.css$': 'identity-obj-proxy',

webpack.config.js

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ module.exports = {
66
path: path.resolve('dist'),
77
filename: 'bundle.js',
88
},
9+
resolve: {
10+
modules: ['node_modules', path.join(__dirname, 'src'), 'shared'],
11+
},
912
module: {
1013
rules: [
1114
{

0 commit comments

Comments
 (0)