Commit 215a01cb authored by Rafael's avatar Rafael

Corrige caminho dos apps no webpack

parent 68f2e754
Pipeline #7956 passed with stage
in 2 minutes and 11 seconds
...@@ -144,7 +144,7 @@ const output = (env) => ({ ...@@ -144,7 +144,7 @@ const output = (env) => ({
chunkFilename: env.production ? 'js/chunks/[name].[chunkhash].js' : 'js/chunks/[name].js', chunkFilename: env.production ? 'js/chunks/[name].[chunkhash].js' : 'js/chunks/[name].js',
filename: env.production ? 'js/[name].[contenthash].js' : 'js/[name].js', filename: env.production ? 'js/[name].[contenthash].js' : 'js/[name].js',
path: DIST, path: DIST,
publicPath: '/', publicPath: '',
}) })
const devServer = (env) => ({ const devServer = (env) => ({
......
...@@ -2,12 +2,16 @@ const express = require('express') ...@@ -2,12 +2,16 @@ const express = require('express')
const path = require('path') const path = require('path')
const server = express() const server = express()
server.use(express.static(path.join(__dirname, 'dist'))) const channel = process.argv[2]
const port = process.argv[3] || 3000
const distPath = channel ? `dist/${channel}` : 'dist'
server.use(express.static(path.join(__dirname, distPath)))
server.get('*', (req, res) => { server.get('*', (req, res) => {
res.sendFile(path.join(__dirname, 'dist', 'index.html')) res.sendFile(path.join(__dirname, distPath, 'index.html'))
}) })
server.listen(3001, () => { server.listen(Number(port), () => {
console.log('Listening at http://localhost:3001/') console.log(`Listening at http://localhost:${port}/`)
}) })
...@@ -146,7 +146,7 @@ const output = (env) => ({ ...@@ -146,7 +146,7 @@ const output = (env) => ({
chunkFilename: env.production ? 'js/chunks/[name].[chunkhash].js' : 'js/chunks/[name].js', chunkFilename: env.production ? 'js/chunks/[name].[chunkhash].js' : 'js/chunks/[name].js',
filename: env.production ? 'js/[name].[contenthash].js' : 'js/[name].js', filename: env.production ? 'js/[name].[contenthash].js' : 'js/[name].js',
path: DIST, path: DIST,
publicPath: '/', publicPath: '',
}) })
const devServer = (env) => ({ const devServer = (env) => ({
...@@ -172,7 +172,7 @@ module.exports = (env) => { ...@@ -172,7 +172,7 @@ module.exports = (env) => {
return { return {
context: SRC, context: SRC,
mode: env.production ? 'production' : 'development', mode: env.production ? 'production' : 'development',
entry: ['./index.tsx'], entry: './index.tsx',
devtool: env.production ? undefined : 'eval-cheap-module-source-map', devtool: env.production ? undefined : 'eval-cheap-module-source-map',
devServer: devServer(env), devServer: devServer(env),
module: { module: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment