diff --git a/app/javascript/application.js b/app/javascript/application.js
index db91aa88..1d46d12e 100644
--- a/app/javascript/application.js
+++ b/app/javascript/application.js
@@ -1 +1,4 @@
// Entry point for the build script in your package.json
+var componentRequireContext = require.context("./components", true);
+var ReactRailsUJS = require("react_ujs");
+ReactRailsUJS.useContext(componentRequireContext);
\ No newline at end of file
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
deleted file mode 100644
index fc913139..00000000
--- a/app/javascript/packs/application.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// Support component names relative to this directory:
-var componentRequireContext = require.context("components", true);
-var ReactRailsUJS = require("react_ujs");
-ReactRailsUJS.useContext(componentRequireContext);
diff --git a/app/javascript/packs/hello_react.jsx b/app/javascript/packs/hello_react.jsx
deleted file mode 100644
index 772fc97e..00000000
--- a/app/javascript/packs/hello_react.jsx
+++ /dev/null
@@ -1,26 +0,0 @@
-// Run this example by adding <%= javascript_pack_tag 'hello_react' %> to the head of your layout file,
-// like app/views/layouts/application.html.erb. All it does is render
Hello React
at the bottom
-// of the page.
-
-import React from 'react'
-import ReactDOM from 'react-dom'
-import PropTypes from 'prop-types'
-
-const Hello = props => (
- Hello {props.name}!
-)
-
-Hello.defaultProps = {
- name: 'David'
-}
-
-Hello.propTypes = {
- name: PropTypes.string
-}
-
-document.addEventListener('DOMContentLoaded', () => {
- ReactDOM.render(
- ,
- document.body.appendChild(document.createElement('div')),
- )
-})
diff --git a/app/javascript/packs/hello_typescript.ts b/app/javascript/packs/hello_typescript.ts
deleted file mode 100644
index 95a72cf0..00000000
--- a/app/javascript/packs/hello_typescript.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-// Run this example by adding <%= javascript_pack_tag 'hello_typescript' %> to the head of your layout file,
-// like app/views/layouts/application.html.erb.
-
-console.log('Hello world from typescript');
diff --git a/app/javascript/packs/server_rendering.js b/app/javascript/packs/server_rendering.js
deleted file mode 100644
index a31e683d..00000000
--- a/app/javascript/packs/server_rendering.js
+++ /dev/null
@@ -1,5 +0,0 @@
-// By default, this pack is loaded for server-side rendering.
-// It must expose react_ujs as `ReactRailsUJS` and prepare a require context.
-var componentRequireContext = require.context("components", true);
-var ReactRailsUJS = require("react_ujs");
-ReactRailsUJS.useContext(componentRequireContext);
diff --git a/webpack.config.js b/webpack.config.js
index ba2f1737..0ec04c18 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -16,5 +16,17 @@ module.exports = {
new webpack.optimize.LimitChunkCountPlugin({
maxChunks: 1
})
- ]
+ ],
+ resolve: {
+ extensions: ['.ts', '.tsx', '.js', '.jsx'],
+ },
+ module: {
+ rules: [
+ {
+ test: /\.(js|jsx|ts|tsx|)$/,
+ exclude: /node_modules/,
+ use: ['babel-loader'],
+ }
+ ]
+ }
}