Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- const ExtractTextPlugin = require("extract-text-webpack-plugin");
- const NODE_ENV = process.env.NODE_ENV || 'development';
- const webpack = require('webpack');
- console.log(__dirname);
- module.exports = {
- context: __dirname + '/app-frontend/src',
- entry: {
- create: './create'
- },
- output: {
- path: __dirname + '/app-frontend/public/js',
- publicPath: '/',
- filename: "[name].js",
- library: '[name]'
- },
- // watch: NODE_ENV == 'development',
- devtool: NODE_ENV == 'development' ? 'source-map' : null,
- plugins : [
- new webpack.NoErrorsPlugin(),
- new webpack.DefinePlugin({
- NODE_ENV: JSON.stringify(NODE_ENV),
- PUBLIC_PATH : JSON.stringify('/public/js')
- }),
- new webpack.optimize.CommonsChunkPlugin({
- name: 'common',
- // chunks: ['ABuilder', 'ADashboard']
- minChunks: 2
- }),
- new ExtractTextPlugin("../css/[name].css")
- ],
- resolve : {
- modulesDirectories: ['node_modules'],
- extensions: ['', '.js']
- },
- resolveLoader : {
- modulesDirectories: ['node_modules'],
- moduleTemplates: ['*-loader', '*'],
- extensions: ['', '.js']
- },
- module: {
- loaders: [
- {
- test: /\.js$/,
- loader: 'babel-loader',
- include: __dirname + '/app-frontend',
- query: {
- presets: ['es2015', 'react']
- }
- },
- {
- test: /\.(png|gif|jpg|svg)/,
- loader: "file-loader?name=[hash].[ext]",
- },
- { test: /\.(eot|woff|woff2|ttf|svg|png|jpe?g|gif)(\?\S*)?$/
- , loader: 'url?limit=100000&name=[name].[ext]'
- },
- {
- test: /\.json$/,
- loaders: ["json-loader"]
- },
- {
- test: /\.css$/,
- loader: ExtractTextPlugin.extract("style-loader", "css-loader", "resolve-url-loader"),
- exclude: /node_modules|tinymce[\\/]skins[\\/]/
- },
- {
- test: /\.less$/,
- loader: ExtractTextPlugin.extract("style-loader", "css-loader!resolve-url-loader!less-loader"),
- exclude: /node_modules/
- }
- ]
- }
- }
- if (NODE_ENV == 'production') {
- module.exports.plugins.push (
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- warnings: false,
- drop_console: true,
- unsafe: true
- }
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement