Azure App Serviceμ razzle μ±μ λ°°ν¬νλ €κ³ νλλ° μλ²λ₯Ό μ€ννλ λ° λ¬Έμ κ° μμ΅λλ€. μ±μ λΉλνκ³ λΉλ ν΄λλ₯Ό μ»μμ΅λλ€. κ·Έλ° λ€μ μ΄ web.config νμΌμ μ¬μ©νμ¬ μ§μ μ μ _build/server.js_λ‘ λ³κ²½νμ΅λλ€. λ‘κ·Έμ ν΄λμμ νμΈνκΈ° λλ¬Έμ μ±μ΄ μ μμ μΌλ‘ μ€νλλ κ² κ°μ΅λλ€.
_π μμνμ΅λλ€_
λνλ©λλ€. μ±μ urlμ κ°λ μλ¬΄λ° μλ΅μ΄ μμ΅λλ€. μμ² μκ°μ΄ μ΄κ³Όλλ©΄ μ€λ₯ 500μ΄ λ°μν©λλ€.
μ€ν μ€μΈ λ‘컬 μ»΄ν¨ν°μμ λΉλλ₯Ό νμΈνμ΅λλ€.
node build/server.js
λͺ¨λ κ²μ΄ μμλλ‘ μλν©λλ€.
λΉμ μ΄ λμΈ μ μκΈ°λ₯Ό λ°λλλ€.
λ¬Έμ μΈμ¬.
μλ ,
μ΄κ²μ μλ§λ #356κ³Ό κ΄λ ¨μ΄ μμ κ²μ
λλ€( PORT
μ κ°μ νκ²½ λ³μλ λΉλ μκ° λμ μΈλΌμΈλ©λλ€). IISNodeλ PORT
λ₯Ό ν΅ν΄ μμ λκΈ°ν λͺ
λͺ
λ νμ΄νλ₯Ό μ§μ νμ§λ§ Razzleμ΄ λΉλ μκ° λμ process.env.PORT
(μλ§λ 3000)μ λν μ‘μΈμ€λ₯Ό μΈλΌμΈνκΈ° λλ¬Έμ μλ²μμ μ ννμ§ μμ΅λλ€.
PORT
μΈλΌμΈμ λ°©μ§νκΈ° μν΄ razzle.config.js
μμ μ΄ ν΄κ²° λ°©λ²μ μ¬μ©ν©λλ€.
module.exports = {
...
modify: (config, { target, dev }, webpack) => {
const appConfig = Object.assign({}, config);
// <strong i="13">@BUG</strong>: Do not inline certain env vars; https://github.com/jaredpalmer/razzle/issues/356
if (target === 'node') {
const idx = appConfig.plugins.findIndex(plugin => plugin.constructor.name === 'DefinePlugin');
const { definitions } = appConfig.plugins[idx];
const newDefs = Object.assign({}, definitions);
delete newDefs['process.env.PORT'];
delete newDefs['process.env.HOST'];
delete newDefs['process.env.PUBLIC_PATH'];
appConfig.plugins = [].concat(appConfig.plugins);
appConfig.plugins[idx] = new webpack.DefinePlugin(newDefs)
}
return appConfig;
},
};
μλ ,
μ΄κ²μ μλ§λ #356κ³Ό κ΄λ ¨μ΄ μμ κ²μ λλ€(
PORT
μ κ°μ νκ²½ λ³μλ λΉλ μκ° λμ μΈλΌμΈλ©λλ€). IISNodeλPORT
λ₯Ό ν΅ν΄ μμ λκΈ°ν λͺ λͺ λ νμ΄νλ₯Ό μ§μ νμ§λ§ Razzleμ΄ λΉλ μκ° λμprocess.env.PORT
(μλ§λ 3000)μ λν μ‘μΈμ€λ₯Ό μΈλΌμΈνκΈ° λλ¬Έμ μλ²μμ μ ννμ§ μμ΅λλ€.
PORT
μΈλΌμΈμ λ°©μ§νκΈ° μν΄razzle.config.js
μμ μ΄ ν΄κ²° λ°©λ²μ μ¬μ©ν©λλ€.module.exports = { ... modify: (config, { target, dev }, webpack) => { const appConfig = Object.assign({}, config); // <strong i="14">@BUG</strong>: Do not inline certain env vars; https://github.com/jaredpalmer/razzle/issues/356 if (target === 'node') { const idx = appConfig.plugins.findIndex(plugin => plugin.constructor.name === 'DefinePlugin'); const { definitions } = appConfig.plugins[idx]; const newDefs = Object.assign({}, definitions); delete newDefs['process.env.PORT']; delete newDefs['process.env.HOST']; delete newDefs['process.env.PUBLIC_PATH']; appConfig.plugins = [].concat(appConfig.plugins); appConfig.plugins[idx] = new webpack.DefinePlugin(newDefs) } return appConfig; }, };
μ΄ κ΅¬μ±μ μλνμ§λ§ λ‘컬μμ 'npm run start:prod ' λͺ λ Ήμ μλνλ©΄ assets.jsonμ μ°Ύμ μ μλ€λ μ€λ₯κ° λ°μν©λλ€. μ΄κ²μ λν΄ μ‘°μΈν΄ μ£Όμκ² μ΅λκΉ?
@vbutani
μ μμμ 'process.env.PUBLIC_PATH'λ₯Ό μμ ν μ€μ μ£Όμ μ²λ¦¬νλ©΄ μλν©λκΉ?
@vbutani
μ μμμ 'process.env.PUBLIC_PATH'λ₯Ό μμ ν μ€μ μ£Όμ μ²λ¦¬νλ©΄ μλν©λκΉ?
λΉ λ₯Έ μλ΅μ λν΄ @fabianisher μκ² κ°μ¬λ립λλ€. λ΄ λμ, μ μλ μ½λ λ³κ²½μ μννλ λμ μμ λ©μλμμ λ΄ μ¬μ©μ μ§μ μ½λ λ¬Έμ λ₯Ό λ°κ²¬νμ΅λλ€.
κ·νμ μ½λλ λ³κ²½ μμ΄ μμ ν μ μλν©λλ€!! μ¬μ©μκ° μμ±ν μ¬μ©μ μ§μ ꡬμ±μ λ²λ€λ server.jsμμ νλ μ½λ©λ PORT κ°μ process.env.PORTλ‘ λ체ν©λλ€.
μ λ§ κ°μ¬ν©λλ€. :)
κ°μ₯ μ μ©ν λκΈ
μλ ,
μ΄κ²μ μλ§λ #356κ³Ό κ΄λ ¨μ΄ μμ κ²μ λλ€(
PORT
μ κ°μ νκ²½ λ³μλ λΉλ μκ° λμ μΈλΌμΈλ©λλ€). IISNodeλPORT
λ₯Ό ν΅ν΄ μμ λκΈ°ν λͺ λͺ λ νμ΄νλ₯Ό μ§μ νμ§λ§ Razzleμ΄ λΉλ μκ° λμprocess.env.PORT
(μλ§λ 3000)μ λν μ‘μΈμ€λ₯Ό μΈλΌμΈνκΈ° λλ¬Έμ μλ²μμ μ ννμ§ μμ΅λλ€.PORT
μΈλΌμΈμ λ°©μ§νκΈ° μν΄razzle.config.js
μμ μ΄ ν΄κ²° λ°©λ²μ μ¬μ©ν©λλ€.