Skip to content

Instantly share code, notes, and snippets.

@XixoWreden
Created June 14, 2020 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XixoWreden/d70a7271e532d6513cd60b3c54d2f9f4 to your computer and use it in GitHub Desktop.
Save XixoWreden/d70a7271e532d6513cd60b3c54d2f9f4 to your computer and use it in GitHub Desktop.
Este Gist muestra la configuración del archivo webpack config, donde indica todo lo necesario para que trabaje con lo producción y no con lo desarrollo, va contruyendo todo en dist(producciòn y lo muestra con el webpack-server)
var HtmlWebpackPlugin = require('html-webpack-plugin');
const path = require('path');
module.exports = {
mode: 'development',
entry: './main.js',
// watch: true,
output: {
path: path.join(__dirname, 'dist'),
// publicPath: '/dist/',
filename: "bundle.js",
chunkFilename: '[name].js'
},
plugins: [new HtmlWebpackPlugin({
template: './index.html'
})],
module: {
rules: [{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
// test: /.jsx?$/,
// include: [
// path.resolve(__dirname, 'app')
// ],
// exclude: [
// path.resolve(__dirname, 'node_modules')
// ],
// loader: 'babel-loader',
// query: {
// presets: [
// ["@babel/env", {
// "targets": {
// "browsers": "last 2 chrome versions"
// }
// }]
// ]
// }
}]
},
// resolve: {
// extensions: ['.json', '.js', '.jsx']
// },
// devtool: 'source-map',
devServer: {
contentBase: path.join(__dirname, '/dist/'),
inline: true,
host: 'localhost',
port: 8081,
}
};
@XixoWreden
Copy link
Author

La estructura de los archivos es:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment