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": [
"enzyme-to-json/serializer"
],
"modulePaths": [
"src",
"node_modules"
],
"moduleNameMapper": {
"\\.svg$": "<rootDir>/src/__mocks__/svgMock.js",
"\\.svg$": "__mocks__/svgMock.js",
"\\.css$": "identity-obj-proxy"
},
"collectCoverageFrom": [

View File

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

View File

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

View File

@ -1,9 +1,9 @@
import React from 'react';
import PropTypes from 'prop-types';
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';
class RavenError extends React.Component {

View File

@ -2,10 +2,10 @@ import React from 'react';
import PropTypes from 'prop-types';
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 Header from '../../components/Header';
import Footer from '../../components/Footer';
import Header from 'components/Header';
import Footer from 'components/Footer';
const Component = ({ t }) => (
<React.Fragment>

View File

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

View File

@ -1,10 +1,10 @@
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 Header from '../../components/Header';
import Footer from '../../components/Footer';
import App from '../../components/App';
import Header from 'components/Header';
import Footer from 'components/Footer';
import App from 'components/App';
const Component = () => (
<React.Fragment>

View File

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

View File

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

View File

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