Last active
March 17, 2016 12:45
-
-
Save darklilium/9a9b64b6e21b4a8668be to your computer and use it in GitHub Desktop.
[Webpack]Module export y configuracion de puerto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Cada que se utilice un nuevo módulo se debe escribir la ruta relativa a la ubicación del archivo javascript en el apartado "entry". | |
| Ejemplo: | |
| ... | |
| module.exports = { | |
| entry: { | |
| login: './static/js/bundles/main.js', | |
| dashboard: './static/js/bundles/dashboard.js', | |
| interruptions: './static/js/bundles/interruptions.js' | |
| }, | |
| ... | |
| Para configurar el archivo de salida, se debe indicar el path directory en donde se generará el archivo y posteriormente su nombre. | |
| En este caso, se quiere dejar en la carpeta "dist" todos los archivos que se encuentran en el directorio, lo cual se indica (cuando | |
| son múltiples archivos) "[name]".js. | |
| Ejemplo: | |
| ... | |
| output: { | |
| path: path.join(__dirname, 'dist'), | |
| filename: '[name].js' | |
| }, | |
| ... | |
| Además, para configurar el puerto (o cambiarlo), se debe editar el apartado devServer del archivo, indicándole el port. | |
| Ejemplo: | |
| ... | |
| devServer: { | |
| inline: true, | |
| port: 443, | |
| host: "127.0.0.1" | |
| }, | |
| ... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment