Setting up webpack resolve root

This commit is contained in:
Jeff Avallone 2018-02-13 20:09:52 -05:00
parent 6b55f1ec72
commit 8817b5f027
11 changed files with 33 additions and 23 deletions

View File

@ -32,8 +32,12 @@
"snapshotSerializers": [ "snapshotSerializers": [
"enzyme-to-json/serializer" "enzyme-to-json/serializer"
], ],
"modulePaths": [
"src",
"node_modules"
],
"moduleNameMapper": { "moduleNameMapper": {
"\\.svg$": "<rootDir>/src/__mocks__/svgMock.js", "\\.svg$": "__mocks__/svgMock.js",
"\\.css$": "identity-obj-proxy" "\\.css$": "identity-obj-proxy"
}, },
"collectCoverageFrom": [ "collectCoverageFrom": [

View File

@ -1,6 +1,6 @@
import React from 'react'; import React from 'react';
import Message from './Message'; import Message from 'components/Message';
const App = () => ( const App = () => (
<Message heading="React App"> <Message heading="React App">

View File

@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import RavenError from '../RavenError'; import RavenError from 'components/RavenError';
class RavenBoundary extends React.Component { class RavenBoundary extends React.Component {
constructor() { constructor() {

View File

@ -1,9 +1,9 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { translate, Trans } from 'react-i18next'; import { translate, Trans } from 'react-i18next';
import { Raven } from '../../sentry'; import { Raven } from 'sentry';
import Message from '../Message'; import Message from 'components/Message';
import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg'; import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg';
class RavenError extends React.Component { class RavenError extends React.Component {

View File

@ -2,10 +2,10 @@ import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { translate, Trans } from 'react-i18next'; import { translate, Trans } from 'react-i18next';
import Message from '../../components/Message'; import Message from 'components/Message';
import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg'; import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg';
import Header from '../../components/Header'; import Header from 'components/Header';
import Footer from '../../components/Footer'; import Footer from 'components/Footer';
const Component = ({ t }) => ( const Component = ({ t }) => (
<React.Fragment> <React.Fragment>

View File

@ -2,12 +2,12 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import Component from './Component'; import Component from './Component';
import RavenBoundary from '../../components/RavenBoundary'; import RavenBoundary from 'components/RavenBoundary';
import '../../style.css'; import 'site.css';
import '../../i18n'; import 'i18n';
import { setupGA } from '../../analytics'; import { setupGA } from 'analytics';
import { Raven, setupRaven } from '../../sentry'; import { Raven, setupRaven } from 'sentry';
setupRaven(); setupRaven();

View File

@ -1,10 +1,10 @@
import React from 'react'; import React from 'react';
import Message from '../../components/Message'; import Message from 'components/Message';
import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg'; import AlertIcon from 'feather-icons/dist/icons/alert-octagon.svg';
import Header from '../../components/Header'; import Header from 'components/Header';
import Footer from '../../components/Footer'; import Footer from 'components/Footer';
import App from '../../components/App'; import App from 'components/App';
const Component = () => ( const Component = () => (
<React.Fragment> <React.Fragment>

View File

@ -2,13 +2,13 @@ import React from 'react';
import ReactDOM from 'react-dom'; import ReactDOM from 'react-dom';
import Component from './Component'; import Component from './Component';
import RavenBoundary from '../../components/RavenBoundary'; import RavenBoundary from 'components/RavenBoundary';
import '../../style.css'; import 'site.css';
import '../../i18n'; import 'i18n';
import { setupServiceWorker } from '../../service-worker'; import { setupServiceWorker } from 'service-worker';
import { setupGA } from '../../analytics'; import { setupGA } from 'analytics';
import { Raven, setupRaven } from '../../sentry'; import { Raven, setupRaven } from 'sentry';
setupRaven(); setupRaven();

View File

@ -44,6 +44,9 @@ module.exports = {
chunkFilename: 'js/[name].[chunkhash:8].js', chunkFilename: 'js/[name].[chunkhash:8].js',
path: path.resolve(__dirname, 'build') path: path.resolve(__dirname, 'build')
}, },
resolve: {
modules: ['src', 'node_modules']
},
plugins: [ plugins: [
new webpack.EnvironmentPlugin({ new webpack.EnvironmentPlugin({
NODE_ENV: 'development', NODE_ENV: 'development',

View File

@ -34,6 +34,9 @@ module.exports = [
chunkFilename: '[name].chunk.js', chunkFilename: '[name].chunk.js',
path: path.resolve(__dirname, 'prerender') path: path.resolve(__dirname, 'prerender')
}, },
resolve: {
modules: ['src', 'node_modules']
},
plugins: [ plugins: [
// Only want the EnvironmentPlugin // Only want the EnvironmentPlugin
common.plugins.find(plugin => plugin instanceof webpack.EnvironmentPlugin) common.plugins.find(plugin => plugin instanceof webpack.EnvironmentPlugin)