]> Untitled Git - lemmy.git/blobdiff - ui/fuse.js
routes.api: fix get_captcha endpoint (#1135)
[lemmy.git] / ui / fuse.js
index 2eb3b15c84f23d9d9644f868a3d6988b6d8ff21a..48f7ecdbacbe19990928073c9039cbc39eb54006 100644 (file)
@@ -4,14 +4,12 @@ const {
   EnvPlugin,
   CSSPlugin,
   WebIndexPlugin,
-  QuantumPlugin
+  QuantumPlugin,
 } = require('fuse-box');
-// const transformInferno = require('../../dist').default
 const transformInferno = require('ts-transform-inferno').default;
 const transformClasscat = require('ts-transform-classcat').default;
 let fuse, app;
 let isProduction = false;
-// var setVersion = require('./set_version.js').setVersion;
 
 Sparky.task('config', _ => {
   fuse = new FuseBox({
@@ -24,35 +22,39 @@ Sparky.task('config', _ => {
     transformers: {
       before: [transformClasscat(), transformInferno()],
     },
+    alias: {
+      locale: 'moment/locale',
+    },
     plugins: [
       EnvPlugin({ NODE_ENV: isProduction ? 'production' : 'development' }),
       CSSPlugin(),
       WebIndexPlugin({
         title: 'Inferno Typescript FuseBox Example',
         template: 'src/index.html',
-        path: isProduction ? "/static" : "/"
+        path: isProduction ? '/static' : '/',
       }),
       isProduction &&
-      QuantumPlugin({
-        bakeApiIntoBundle: 'app',
-        treeshake: true,
-        uglify: true,
-      }),
+        QuantumPlugin({
+          bakeApiIntoBundle: 'app',
+          treeshake: true,
+          uglify: true,
+        }),
     ],
   });
   app = fuse.bundle('app').instructions('>index.tsx');
 });
-// Sparky.task('version', _ => setVersion());
 Sparky.task('clean', _ => Sparky.src('dist/').clean('dist/'));
 Sparky.task('env', _ => (isProduction = true));
-Sparky.task('copy-assets', () => Sparky.src('assets/*.svg').dest('dist/'));
-Sparky.task('copy-assets', () => Sparky.src('assets/*.png').dest('dist/'));
+Sparky.task('copy-assets', () =>
+  Sparky.src('assets/**/**.*').dest(isProduction ? 'dist/' : 'dist/static')
+);
 Sparky.task('dev', ['clean', 'config', 'copy-assets'], _ => {
-  fuse.dev();
+  fuse.dev({
+    fallback: 'index.html',
+  });
   app.hmr().watch();
   return fuse.run();
 });
 Sparky.task('prod', ['clean', 'env', 'config', 'copy-assets'], _ => {
-  // fuse.dev({ reload: true }); // remove after demo
   return fuse.run();
 });