Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const webpack = require('webpack');
- const ExtractTextPlugin = require('extract-text-webpack-plugin');
- const extractCSS = new ExtractTextPlugin('css/style.css');
- const CopyWebpackPlugin = require('copy-webpack-plugin');
- const config = {
- context: __dirname + '/src',
- entry: {
- app: './app.js',
- vendor: [
- 'blazy',
- 'fancybox',
- 'owl.carousel'
- ],
- constructor: './js/constructor.js',
- },
- resolve: {
- modules: ['node_modules']
- },
- output: {
- path: __dirname + '/dist',
- filename: 'js/[name].js'
- },
- module: {
- rules: [{
- test: /\.js$/,
- include: __dirname + '/src',
- use: [{
- loader: 'babel-loader',
- options: {
- presets: [
- ['es2015', { modules: false }]
- ]
- }
- }]
- },
- {
- test: /\.(jpe?g|png|gif)$/i,
- loader: "file-loader?name=../images/[name].[ext]&outputPath=../dist/images/"
- },
- {
- test: /\.(eot|svg|ttf|woff|woff2)$/,
- loader: 'file-loader?name=../fonts/[name].[ext]&outputPath=../dist/fonts/'
- },
- {
- test: /style\.less$/,
- loader: ExtractTextPlugin.extract({
- fallbackLoader: 'style-loader',
- loader: "css-loader!less-loader",
- })
- }
- ]
- },
- plugins: [
- extractCSS,
- new webpack.ProvidePlugin({
- $: 'jquery',
- jQuery: 'jquery',
- "window.jQuery": "jquery/dist/jquery.min.js"
- }),
- new CopyWebpackPlugin([
- { from: './images', to: './images' },
- { from: '../../../node_modules/constructor/dist/constructor.js', to: './js/constructor.lib.min.js' }
- ]),
- new webpack.optimize.CommonsChunkPlugin({
- name: "vendor",
- minChunks: Infinity,
- })
- ],
- };
- module.exports = config;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement