Skip to content

Commit

Permalink
Switch esbuild to a build script
Browse files Browse the repository at this point in the history
  • Loading branch information
dottorblaster committed Feb 25, 2022
1 parent a48ca7b commit 443bde5
Show file tree
Hide file tree
Showing 6 changed files with 563 additions and 9 deletions.
33 changes: 33 additions & 0 deletions assets/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
const path = require('path');
const alias = require('esbuild-plugin-path-alias');

const resolvePath = (p) => path.resolve(__dirname, p);

require('esbuild')
.build({
entryPoints: ['js/app.js', 'js/tronto.jsx'],
outdir: resolvePath('../priv/static/assets'),
bundle: true,
minify: true,
loader: {
'.png': 'dataurl',
'.svg': 'dataurl',
},
watch: Boolean(process.env.ESBUILD_WATCH),
plugins: [
alias({
phoenix: resolvePath('../deps/phoenix/priv/static/phoenix.esm.js'),
phoenix_html: resolvePath(
'../deps/phoenix_html/priv/static/phoenix_html.js'
),
phoenix_live_view: resolvePath(
'../deps/phoenix_live_view/priv/static/phoenix_live_view.esm.js'
),
'@components': resolvePath('./js/components'),
}),
],
})
.then((_result) => {
console.log('Built!');
})
.catch((err) => console.log(err));
2 changes: 1 addition & 1 deletion assets/js/components/ClustersList.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { Fragment } from 'react';
import { useSelector, useDispatch } from 'react-redux';
import { useNavigate, Link } from 'react-router-dom';
import { Menu, Transition} from '@headlessui/react';
import { Menu, Transition } from '@headlessui/react';

import {
EOS_EDIT,
Expand Down
12 changes: 6 additions & 6 deletions assets/js/tronto.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { Provider } from 'react-redux';

import { store } from './state';

import Layout from './components/Layout';
import Home from './components/Home';
import HostsList from './components/HostsList';
import ClustersList from './components/ClustersList';
import ChecksSelection from './components/ChecksSelection';
import ChecksResults from './components/ChecksResults';
import Layout from '@components/Layout';
import Home from '@components/Home';
import HostsList from '@components/HostsList';
import ClustersList from '@components/ClustersList';
import ChecksSelection from '@components/ChecksSelection';
import ChecksResults from '@components/ChecksResults';

const App = () => {
return (
Expand Down
Loading

0 comments on commit 443bde5

Please sign in to comment.