Ver código fonte

Change back to using a dotfile to hold bundles.

Lee Morgan 4 dias atrás
pai
commit
0dcd4977e2
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      index.js

+ 3 - 3
index.js

@@ -20,7 +20,7 @@ export default async (express, options)=>{
     await fs.rm(path.join(process.cwd(), ".build/"), {recursive: true, force: true});
     let root = path.join(process.cwd(), opts.routesDir);
     await addRoute(root, root, app, opts);
-    app.use(assetsRoute, express.static(opts.assetsDir));
+    app.use(opts.assetsRoute, express.static(opts.assetsDir));
 
     console.timeEnd("Build time");
     return app;
@@ -35,11 +35,11 @@ const addRoute = async (dir, root, app, opts)=>{
     route = route === "" ? "/" : route;
     if(opts.production){
         const bundle = await parseComponent(indexFile);
-        const bundleLocation = dir.replace(opts.routesDir, "build");
+        const bundleLocation = dir.replace(opts.routesDir, ".build");
         const htmlPath = path.join(bundleLocation, "index.html");
         await fs.mkdir(bundleLocation, {recursive: true});
         await fs.writeFile(htmlPath, bundle);
-        app.get(route, async (req, res)=>{res.sendFile(htmlPath)});
+        app.get(route, async (req, res)=>{res.sendFile(htmlPath, {dotfiles: "allow"})});
     }else{
         app.get(route, async (req, res)=>{res.send(await parseComponent(indexFile))});
     }