Created
April 7, 2019 15:33
-
-
Save amandavitoriaav/84396804d99dcd54605cd5b9aeb3e56a to your computer and use it in GitHub Desktop.
Erro ao copilar o código - Aula 06 - Atividade 05
This file contains 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
const path = require('path'); | |
const babiliPlugin = require('babili-webpack-plugin'); | |
const extractTextPlugin = require('extract-text-webpack-plugin'); | |
const optimizeCSSAssetsPlugin = require('optimize-css-assets-webpack-plugin'); | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
let plugins = []; | |
plugins.push(new HtmlWebpackPlugin({ | |
hash: true, | |
minify: { | |
html5: true, | |
collapseWhitespace: true, | |
removeComments: true, | |
}, | |
filename: 'index.html', | |
template: __dirname + '/main.html' | |
})); | |
plugins.push(new extractTextPlugin('styles.css')); | |
plugins.push(new webpack.ProvidePlugin({ | |
$: 'jquery/dist/jquery.js', | |
jQuery: 'jquery/dist/jquery.js' | |
})); | |
plugins.push(new webpack.optimize.CommonsChunkPlugin({ | |
name: 'vendor', | |
filename: 'vendor.bundle.js' | |
})); | |
if (process.env.NODE_ENV == 'production') { | |
plugins.push(new webpack.optimize.ModuleConcatenationPlugin()); | |
plugins.push(new babiliPlugin()); | |
plugins.push(new optimizeCSSAssetsPlugin({ | |
cssProcessor: require('cssnano'), | |
cssProcessorOptions: { | |
discardComments: { | |
removeAll: true | |
} | |
}, | |
canPrint: true | |
})); | |
} | |
module.exports = { | |
entry: { | |
app: './app-src/app.js', | |
vendor: ['jquery', 'bootstrap', 'reflect-metadata'] | |
}, | |
output: { | |
filename: 'bundle.js', | |
path: path.resolve(__dirname, 'dist'), | |
}, | |
module: { | |
rules: [{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
use: { | |
loader: 'babel-loader' | |
} | |
}, | |
{ | |
test: /\.css$/, | |
use: extractTextPlugin.extract({ | |
fallback: 'style-loader', | |
use: 'css-loader' | |
}) | |
}, | |
{ | |
test: /\.(woff|woff2)(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url-loader?limit=10000&mimetype=application/font-woff' | |
}, | |
{ | |
test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url-loader?limit=10000&mimetype=application/octet-stream' | |
}, | |
{ | |
test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'file-loader' | |
}, | |
{ | |
test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, | |
loader: 'url-loader?limit=10000&mimetype=image/svg+xml' | |
} | |
] | |
}, | |
plugins | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment