function PluginWebpackConfig(fqcn, _options, additionalConfig) {
  const options = merge(defaultOptions, _options);
  const VENDOR_MANIFEST = require(path.resolve(_options.web_src_path, 'manifests', 'vendor-manifest.json'));

  const plugins = [
    new webpack.DllReferencePlugin({ manifest: VENDOR_MANIFEST, context: options.root_path }),
    new HtmlWebpackPlugin({ filename: getPluginFullName(fqcn) + '.module.json', inject: false, template: path.resolve(_options.web_src_path, 'templates', 'module.json.template') }),
  ];

  const config = merge.smart(
    require(path.resolve(_options.web_src_path, 'webpack.config.js')),
    {
      output: {
        path: options.build_path,
      },
      plugins: plugins,
      resolve: {
        modulesDirectories: [ path.resolve(options.entry_path, '..') ],
      },
    }
  );

  const entry = {};
  entry[getPluginFullName(fqcn)] = options.entry_path;

  config.entry = entry;

  if (additionalConfig) {
    return merge.smart(config, additionalConfig);
  }

  return config;
}
export default function ({
	prod = false
} = {}) {
	if (prod) {
		return merge.smart(BASE_SETTINGS, PROD_SETTINGS)
	}
	return merge.smart(BASE_SETTINGS, DEV_SETTINGS)
}
Example #3
0
//Module config
function _load() {
   if (target === 'test') {
      return merge.smart(wbpk.global(), wbpk.test());
   } else if (target === 'production') {
      return merge.smart(wbpk.global(),
         wbpk.output(path, paths.appPath, paths.buildPath, pkg),
         wbpk.production(webpack));
   }
   // default state - development (with devserver configs)
   return merge.smart(wbpk.global(),
      wbpk.output(path, paths.appPath, paths.buildPath, pkg),
      wbpk.development(webpack));
}
function createConfig (conf) {
  conf = Object.assign({}, defaultConfig, conf)

  const baseConfig = {
    // Don't attempt to continue if there are any errors.
    bail: true,
    context: ROOT,
    entry: [require.resolve('./polyfills.js')].concat(ensureArray(conf.in)),
    resolve: {
      root: [SRC_DIR, MODULES_DIR]
    },
    output: {
      path: path.join(ROOT, conf.out),
      filename: '[name].[hash:8].js',
      chunkFilename: '[name].[chunkhash:8].chunk.js',
      publicPath: '/'
    },
    loaders: [
      {
        test: /\.json$/,
        loader: 'json'
      }
    ],
    plugins: [
      new webpack.optimize.OccurrenceOrderPlugin(),
      // new webpack.optimize.DedupePlugin(), // Disabled for now because it causes problems
      new HtmlWebpackPlugin({
        template: conf.template ? path.join(ROOT, conf.template) : path.join(ROOT, 'src/index.html'),
        hash: false,
        filename: 'index.html',
        inject: 'body',
        minify: {
          collapseWhitespace: true
        }
      })
    ]
  }

  if (conf.globals) {
    baseConfig.plugins.unshift(new webpack.DefinePlugin(conf.globals))
  }

  const assetsConfig = createAssetsConfig(conf)
  const scriptsConfig = createScriptsConfig(conf)
  const stylesConfig = createStylesConfig(conf)
  const hotConfig = createHotConfig(conf, baseConfig)

  return (isDev && conf.hot)
    ? smart(assetsConfig, scriptsConfig, stylesConfig, hotConfig, baseConfig)
    : smart(assetsConfig, scriptsConfig, stylesConfig, baseConfig)
}
Example #5
0
module.exports = () => {

    const commonConfig = {
        stats: { modules: false },
        entry: "./src/index.ts",
        output: {
            filename: "bundle.js",
            path: __dirname + "/lib",
            library: 'MdObject',
            libraryTarget: 'umd'
        },
        devtool: "source-map", // Enable sourcemaps for debugging webpack's output.
        resolve: {
            extensions: [".ts"] // Add '.ts' as resolvable extensions.
        },
        module: {
            rules: [ // All files with a '.ts' extension will be handled by 'awesome-typescript-loader'.
                { test: /\.ts$/, use: "awesome-typescript-loader" }
            ]
        },
        plugins: [
            new CheckerPlugin()
        ]
    }

    const uglifyConfig = merge.smart(commonConfig, {
        output: {
            filename: "bundle.min.js",
        },
        plugins: [
            new UglifyjsWebpackPlugin({
                sourceMap: true,
                extractComments: /\/\*![\s\S]*\*\//,
                uglifyOptions: {
                    ie8: true
                }
            })
        ]
    });

    const publicConfig = merge.smart(uglifyConfig, {
        entry: "./src/public.ts",
        output: {
            filename: "bundle.public.min.js",
        },
        plugins: []
    })

    return [commonConfig, uglifyConfig, publicConfig];
}
Example #6
0
const prod = (base, { main }) =>
  merge.smart(base, {
    mode: 'production',
    devtool: 'source-map',
    entry: [resolve(main)],
    module: {
      rules: [
        {
          test: /\.(css|less)$/,
          loader: [
            MiniCssExtractPlugin.loader,
            {
              loader: nodeResolve('css-loader'),
              options: { sourceMap: true },
            },
            {
              loader: nodeResolve('less-loader'),
              options: { sourceMap: true },
            },
          ],
        },
      ],
    },
    plugins: [new MiniCssExtractPlugin({ filename: 'styles.[hash].css' })],
  })
Example #7
0
module.exports = (env, argv) => {
  if (argv.mode !== 'development') throw new Error('Not development mode!!');
  ////////////////////////////////////////////////////////////////////////
  // library build setting
  const config = merge.smart(common.webpackConfig, webpackConfig);

  ////////////////////////////////////////////////////////////////////////
  // test bundle build setting
  if(process.env.TEST_ENV){

    // when NODE_ENV = html is set, only test bundles are generated.
    // this is only the case where the bundled js files are generated for test using html file.
    // NOTE Karma does not refer to config.entry, and it pre-process the spec files written in karma.conf.js
    if(process.env.NODE_ENV === 'html'){
      config.entry = getEntriesForHTMLTest(config);
      createNewHtml(config.entry); // Edit HTML here
    }

    // for require through dynamic variables in webpack
    config.plugins.push(
      new webpack.ContextReplacementPlugin(
        RegExp('./src'), RegExp(common.entryName)// only src/index.js is allowed to get imported.
      ),
      new webpack.ContextReplacementPlugin(
        RegExp('./dist'), RegExp(common.bundleName)// only dist/xxx.bundle.js is allowed to get imported.
      )
    );
  }

  return config;
};
Example #8
0
const test = (base, { main }) =>
  merge.smart(base, {
    mode: 'development',
    devtool: 'cheap-module-eval-source-map',
    node: {
      __filename: true,
    },
    entry: glob.sync('src/main/webapp/**/*spec.js*').map(resolve),
    output: {
      path: resolve('target/test/'),
      filename: 'test.js',
    },
    plugins: [
      new HtmlWebpackPlugin(),
      new webpack.HotModuleReplacementPlugin(),
    ],
    module: {
      rules: [
        {
          test: /.*spec\.jsx?$/,
          use: [
            nodeResolve('mocha-loader'),
            path.resolve(__dirname, 'spec-loader.js'),
            babelLoader(),
          ],
          exclude: /node_modules/,
        },
      ],
    },
  })
Example #9
0
module.exports = (env, argv) => {
  if(argv.mode !== 'production') throw new Error('Not production mode!!');

  const config = merge.smart(common.webpackConfig, webpackConfig);
  // config.output.filename = common.webpackConfig.output.filename.replace(/\.js$/, '.min.js');

  return config;
};
Example #10
0
export default function configureWebpackPlugins (config) {
  const { disabledPlugins = [], webpackConfig: userWebpackConfig, ...extraConfig } = config

  const defaultWebpackConfig = plugins
    .filter(plugin => disabledPlugins.indexOf(plugin.name) === -1)
    .reduce((webpackConfig, plugin) => {
      return merge.smart(webpackConfig, plugin.configure(extraConfig))
    }, {})

  return merge.smart(defaultWebpackConfig, userWebpackConfig)
}
Example #11
0
module.exports = () =>
  merge.smart(common, {
    target: 'electron-main',
    entry: path.join(__dirname, '..', `app/src/index.main.js`),
    output: {
      filename: 'index.main.js',
    },
    node: {
      __dirname: false,
      __filename: false,
    },
  });
Example #12
0
module.exports = (env) => {
    const isDev = env && env.dev;
    const isDevServer = process.argv[1].indexOf('server') >= 0;

    if (isDevServer) {
        return merge.smart(
            baseConfig(env),
            serverConfig(env)
        );
    } else if (isDev) {
        return merge.smart(
            baseConfig(env),
            devConfig(env)
        );
    } else {
        return merge.smart(
            baseConfig(env),
            prodConfig(env)
        );
    }
};
Example #13
0
const dev = (base, { main }) =>
  merge.smart(base, {
    mode: 'development',
    devtool: 'cheap-module-eval-source-map',
    entry: [nodeResolve('console-polyfill'), resolve(main)],
    plugins: [
      new webpack.NamedModulesPlugin(),
      new webpack.HotModuleReplacementPlugin(),
      new SimpleProgressWebpackPlugin({
        format: 'compact',
      }),
    ],
  })
module.exports = (env, argv) =>
  merge.smart(baseConfig, {
    devtool:
      argv.mode === 'development'
        ? 'eval-source-map'
        : 'cheap-module-source-map',
    target: 'electron-renderer',

    output: {
      path: resolve(__dirname, 'build'),
      filename: '[name].js',
    },

    entry: {
      'webview-preload': './src/preloads/webview-preload.ts',
      'background-page-preload': './src/preloads/background-page-preload.ts',
    },
  });
Example #15
0
 .reduce((webpackConfig, plugin) => {
   return merge.smart(webpackConfig, plugin.configure(extraConfig))
 }, {})
export default merge.smart(baseConfig, {
  devtool: 'inline-source-map',

  target: 'electron-renderer',

  entry: [
    'react-hot-loader/patch',
    `webpack-dev-server/client?http://localhost:${port}/`,
    'webpack/hot/only-dev-server',
    path.join(__dirname, 'app/index.js'),
  ],

  output: {
    publicPath: `http://localhost:${port}/dist/`,
    filename: 'renderer.dev.js'
  },

  module: {
    rules: [
      {
        test: /\.jsx?$/,
        exclude: /node_modules/,
        use: {
          loader: 'babel-loader',
          options: {
            cacheDirectory: true,
            plugins: [
              // Here, we include babel plugins that are only required for the
              // renderer process. The 'transform-*' plugins must be included
              // before react-hot-loader/babel
              'transform-class-properties',
              'transform-es2015-classes',
              'react-hot-loader/babel'
            ],
          }
        }
      },
      {
        test: /\.global\.css$/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
            },
          }
        ]
      },
      {
        test: /^((?!\.global).)*\.css$/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              modules: true,
              sourceMap: true,
              importLoaders: 1,
              localIdentName: '[name]__[local]__[hash:base64:5]',
            }
          },
        ]
      },
      // SASS support - compile all .global.scss files and pipe it to style.css
      {
        test: /\.global\.scss$/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
            },
          },
          {
            loader: 'sass-loader'
          }
        ]
      },
      // SASS support - compile all other .scss files and pipe it to style.css
      {
        test: /^((?!\.global).)*\.scss$/,
        use: [
          {
            loader: 'style-loader'
          },
          {
            loader: 'css-loader',
            options: {
              modules: true,
              sourceMap: true,
              importLoaders: 1,
              localIdentName: '[name]__[local]__[hash:base64:5]',
            }
          },
          {
            loader: 'sass-loader'
          }
        ]
      },
      // WOFF Font
      {
        test: /\.woff(\?v=\d+\.\d+\.\d+)?$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 10000,
            mimetype: 'application/font-woff',
          }
        },
      },
      // WOFF2 Font
      {
        test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 10000,
            mimetype: 'application/font-woff',
          }
        }
      },
      // TTF Font
      {
        test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 10000,
            mimetype: 'application/octet-stream'
          }
        }
      },
      // EOT Font
      {
        test: /\.eot(\?v=\d+\.\d+\.\d+)?$/,
        use: 'file-loader',
      },
      // SVG Font
      {
        test: /\.svg(\?v=\d+\.\d+\.\d+)?$/,
        use: {
          loader: 'url-loader',
          options: {
            limit: 10000,
            mimetype: 'image/svg+xml',
          }
        }
      },
      // Common Image Formats
      {
        test: /\.(?:ico|gif|png|jpg|jpeg|webp)$/,
        use: 'url-loader',
      }
    ]
  },

  plugins: [
    new webpack.DllReferencePlugin({
      context: process.cwd(),
      manifest: require(manifest),
      sourceType: 'var',
    }),

    new webpack.HotModuleReplacementPlugin({
      multiStep: true
    }),

    new webpack.NoEmitOnErrorsPlugin(),

    /**
     * Create global constants which can be configured at compile time.
     *
     * Useful for allowing different behaviour between development builds and
     * release builds
     *
     * NODE_ENV should be production so that modules do not perform certain
     * development checks
     *
     * By default, use 'development' as NODE_ENV. This can be overriden with
     * 'staging', for example, by changing the ENV variables in the npm scripts
     */
    new webpack.EnvironmentPlugin({
      NODE_ENV: 'development'
    }),

    new webpack.LoaderOptionsPlugin({
      debug: true
    }),

    new ExtractTextPlugin({
      filename: '[name].css'
    }),
  ],

  node: {
    __dirname: false,
    __filename: false
  },

  devServer: {
    port,
    publicPath,
    compress: true,
    noInfo: true,
    stats: 'errors-only',
    inline: true,
    lazy: false,
    hot: true,
    headers: { 'Access-Control-Allow-Origin': '*' },
    contentBase: path.join(__dirname, 'dist'),
    watchOptions: {
      aggregateTimeout: 300,
      ignored: /node_modules/,
      poll: 100
    },
    historyApiFallback: {
      verbose: true,
      disableDotRule: false,
    },
    before() {
      console.log('찍혀라[webpack.config.render.dev]', 'START_HOT 환경변수:', process.env.START_HOT);
      if (process.env.START_HOT) {
        console.log('Starting Main Process...');
        console.log('찍혀라[webpack.config.render.dev]', 'child_process를 생성함.')
        spawn(
          'npm',
          ['run', 'start-main-dev'],
          { shell: true, env: process.env, stdio: 'inherit' }
        )
          .on('close', code => process.exit(code))
          .on('error', spawnError => console.error(spawnError));
      }
    }
  },
});
Example #17
0
 (mergedConfig, setter) => {
   const configPartial = setter(context, getCompleteConfig(mergedConfig))
   return merge.smart(mergedConfig, configPartial)
 },
Example #18
0
File: dev.js Project: SmithJosh/ddf
var webpack = require('webpack');
var merge = require('webpack-merge');
var base = require('./base');

module.exports = merge.smart(base, {
    entry: [
        'stack-source-map/register',
        'console-polyfill'
    ]
});
Example #19
0
        use    : 'babel-loader',
        exclude: path.join(__dirname, 'node_modules')
      },
      {
        test: /\.css$/,
        use : [
          'style-loader',
          ...cssLoaders
        ]

        // loader: ExtractTextPlugin.extract({
        //   fallbackLoader: 'style-loader',
        //   loader: cssLoaders
        // })
      }
    ]
  },
  plugins: [

    // new ExtractTextPlugin('styles.css'),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
    }),
    new webpack.NoErrorsPlugin(),
    new CaseSensitivePathsPlugin()
  ],
  performance: { hints: false }
};

module.exports = merge.smart(common, config);
module.exports = merge.smart(common, {
  mode: 'production',
  module: {
    rules: [
      {
        test: /\.html$/,
        use: {
          loader: 'html-loader',
          options: {
            minimize: true
          }
        }
      },
      {
        test: /\.s?css$/,
        use: [
          MiniCssExtractPlugin.loader,
          {
            loader: 'css-loader',
            options: {
              importLoaders: 1,
              modules: true,
              localIdentName: '[local]___[hash:base64:5]'
            }
          },
          {
            loader: 'postcss-loader',
            options: {
              plugins: () => [autoprefixer()]
            }
          },
          {
            loader: 'sass-loader'
          }
        ]
      },
      {
        test: /\.(gif|jpg|png|svg|ico)$/,
        use: 'image-webpack-loader'
      }
    ]
  },
  optimization: {
    minimizer: [
      new OptimizeCSSAssetsPlugin({
        cssProcessorOptions: { discardUnused: false }
      })
    ]
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: '[name].min.css'
    }),
    new UglifyJsWebpackPlugin(),
    new webpack.DefinePlugin({
      'process.env.NODE_ENV': JSON.stringify('production')
    })
  ]
});
export default merge.smart(baseConfig, {
  // devtool: 'source-map',
  devtool: 'inline-source-map',

  target: 'web',

  entry: ['babel-polyfill', './app/index'],

  output: {
    libraryTarget: 'window', // 'commonjs2',
    path: path.join(__dirname, 'cordova/www/dist'),
    publicPath: './dist/'
  },

  optimization: {
    // We no not want to minimize our code. TODO remove this for production
    minimize: false
  },

  node: {
    fs: 'empty',
    child_process: 'empty'
  },

  module: {
    rules: [
      // Extract all .global.css to style.css as is
      {
        test: /\.global\.css$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader,
            options: {
              publicPath: './'
            }
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true
            }
          }
        ]
      },
      // Pipe other styles through css modules and append to style.css
      {
        test: /^((?!\.global).)*\.css$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader
          },
          {
            loader: 'css-loader',
            options: {
              modules: true,
              localIdentName: '[name]__[local]__[hash:base64:5]',
              sourceMap: true
            }
          }
        ]
      },
      // Add SASS support  - compile all .global.scss files and pipe it to style.css
      {
        test: /\.global\.(scss|sass)$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader
          },
          {
            loader: 'css-loader',
            options: {
              sourceMap: true,
              importLoaders: 1
            }
          },
          {
            loader: 'sass-loader',
            options: {
              sourceMap: true
            }
          }
        ]
      },
      // Add SASS support  - compile all other .scss files and pipe it to style.css
      {
        test: /^((?!\.global).)*\.(scss|sass)$/,
        use: [
          {
            loader: MiniCssExtractPlugin.loader
          },
          {
            loader: 'css-loader',
            options: {
              modules: true,
              importLoaders: 1,
              localIdentName: '[name]__[local]__[hash:base64:5]',
              sourceMap: true
            }
          },
          {
            loader: 'sass-loader',
            options: {
              sourceMap: true
            }
          }
        ]
      },
      // Fonts
      {
        test: /\.(woff|woff2|eot|ttf)$/,
        use: [{
          loader: 'file-loader',
          options: {
            publicPath: '../dist/',
          }
        }]
      },
      // Text files
      {
        test: /\.(txt)$/,
        use: 'raw-loader'
      },
      // Common Image Formats
      {
        test: /\.(?:ico|gif|png|jpg|jpeg|webp|svg)$/,
        use: 'url-loader',
      }
    ]
  },

  plugins: [
    /**
     * Create global constants which can be configured at compile time.
     *
     * Useful for allowing different behaviour between development builds and
     * release builds
     *
     * NODE_ENV should be production so that modules do not perform certain
     * development checks
     */
    new webpack.DefinePlugin({ // evtl make process.env.NODE_ENV false for cordova and web
      'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production')
    }),

    new webpack.IgnorePlugin(/electron-io/),

    new MiniCssExtractPlugin({
      filename: 'style.css'
    }),

  ],
});
module.exports = webpackMerge.smart(require('./webpack.common.config'), {
    module: {
        loaders: [
            /* Support for .ts files. */
            {
                test: /\.ts$/,
                loader: 'awesome-typescript-loader',
                exclude: [/\.(spec|e2e|async)\.ts$/]
            }
        ]
    },
    plugins: [
        new CleanWebpackPlugin([webpackHelper.distDirectoryName], {
            root: webpackHelper.rootPath,
            verbose: true,
            dry: false
        }),
        new SplitByPathPlugin([
            {
                name: 'vendor',
                path: path.join(webpackHelper.rootPath, 'node_modules')
            }
        ]),
        new webpack.optimize.OccurenceOrderPlugin(true),
        //new webpack.optimize.CommonsChunkPlugin({
        //    name: 'polyfills',
        //    filename: assetsScriptsPath + 'polyfills.bundle.js',
        //    minChunks: Infinity
        //}),
        /* Static assets. */
        new CopyWebpackPlugin([
            {
                from: webpackHelper.appTemplatesPath,
                to: webpackHelper.templatesDirectoryName
            }
        ]),
        /* Injecting tags in html. */
        new HtmlWebpackPlugin({
            filename: path.join(webpackHelper.templatesDirectoryName, 'home_body.html'),
            template: path.join(webpackHelper.appTemplatesPath, 'home_body.html')
        })
    ]
});
var parseBundlePlugin = function(data, base_dir) {
  if (
    typeof data.src_file === 'undefined' ||
    typeof data.name === 'undefined' ||
    typeof data.static_dir === 'undefined' ||
    typeof data.static_url_root === 'undefined' ||
    typeof data.stats_file === 'undefined' ||
    typeof data.locale_data_folder === 'undefined' ||
    typeof data.plugin_path === 'undefined' ||
    typeof data.version === 'undefined'
  ) {
    logging.error(data.name + ' plugin is misconfigured, missing parameter(s)');
    return;
  }

  // Start from a base configuration file that defines common features of the webpack configuration for all Kolibri
  // plugins (including the core app).
  var bundle = _.cloneDeep(base_config);
  var external;
  var library;

  var local_config;

  try {
    local_config = require(path.resolve(path.join(data.plugin_path, 'webpack.config.js')));
  } catch (e) {
    local_config = {};
  }

  if (local_config.coreAPISpec) {
    // Resolve this path now so that it can be unproblematically resolved later.
    local_config.coreAPISpec = path.resolve(path.join(data.plugin_path, local_config.coreAPISpec));
  }

  // This might be non-standard use of the entry option? It seems to
  // interact with read_bundle_plugins.js
  bundle.entry = {};
  bundle.entry[data.name] = path.join(data.plugin_path, data.src_file);

  if (typeof data.external !== 'undefined' && data.external && data.core_name) {
    // If we want to create a plugin that can be directly referenced by other plugins, this sets it to be
    // instantiated as a global variable. Only to be used by the Kolibri core app.
    external = data.name;
    library = data.core_name;
  }

  // Add local resolution paths
  bundle.resolve.modules = [
    path.join(data.plugin_path, 'node_modules'),
    base_dir,
    path.join(base_dir, 'node_modules'),
  ];
  // Add local and global resolution paths for loaders to allow any plugin to
  // access kolibri/node_modules loaders during bundling.
  bundle['resolveLoader'] = {
    modules: [
      path.join(data.plugin_path, 'node_modules'),
      base_dir,
      path.join(base_dir, 'node_modules'),
    ],
  };

  // Calculate these paths here, so that we can export __publicPath as a variable in the webpack define plugin
  var publicPath, outputPath;

  if (process.env.DEV_SERVER) {
    var devServerConfig = require('./webpackdevserverconfig');
    // If running webpack dev server point to that endpoint.
    publicPath = devServerConfig.publicPath;
    // Set output path to base dir, as no files will be written - all built files are cached in memory.
    outputPath = devServerConfig.basePath
      ? path.resolve(path.join(base_dir, devServerConfig.basePath))
      : path.resolve(base_dir);
  } else {
    publicPath = path.join('/', data.static_url_root, data.name, '/');
    outputPath = path.resolve(path.join(data.static_dir, data.name));
  }

  bundle.plugins = bundle.plugins.concat([
    new ExtractTextPlugin('[name]' + data.version + '.css'),
    new WebpackRTLPlugin({
      minify: { zindex: false },
    }),
    // BundleTracker creates stats about our built files which we can then pass to Django to allow our template
    // tags to load the correct frontend files.
    new BundleTracker({
      path: path.dirname(data.stats_file),
      filename: path.basename(data.stats_file),
    }),
    // Plugins know their own name, by having a variable that we define here, based on the name they are given
    // in kolibri_plugins.py inside their relevant module.
    // We also pass in the events hashes here as well, as they are defined in the Python specification of the
    // KolibriModule.
    new webpack.DefinePlugin({
      __kolibriModuleName: JSON.stringify(data.name),
      __events: JSON.stringify(data.events || {}),
      __once: JSON.stringify(data.once || {}),
      __version: JSON.stringify(data.version),
      // This is necessary to allow modules that use service workers to fetch their service worker code
      __publicPath: JSON.stringify(publicPath),
    }),
    new extract$trs(data.locale_data_folder, data.name),
  ]);

  bundle = merge.smart(bundle, local_config);

  bundle.core_name = data.core_name;
  bundle.name = data.name;
  bundle.context = base_dir;
  bundle.output = {
    path: outputPath,
    filename: '[name]-' + data.version + '.js',
    // Need to define this in order for chunks to be named
    // Without this chunks from different bundles will likely have colliding names
    chunkFilename: '[name]-' + data.version + '.js',
    publicPath: publicPath,
    library: library,
  };

  return [bundle, external];
};
Example #24
0
module.exports = merge.smart(require('./webpack.base.js'), {
  entry: {
    cms: './index',
  },
  output: {
    path: path.join(__dirname, 'dist'),
    filename: '[name].js',
    library: 'netlify-cms',
    libraryTarget: 'umd',
    umdNamedDefine: true,
  },
  context: path.join(__dirname, 'src'),
  plugins: [
    new webpack.DefinePlugin({
      'process.env': {
        NODE_ENV: JSON.stringify('production'),
      },
    }),
    new webpack.DefinePlugin({
      NETLIFY_CMS_VERSION: JSON.stringify(require("./package.json").version),
    }),

    // Minify and optimize the JavaScript
    new webpack.optimize.UglifyJsPlugin({
      compress: {
        // ...but do not show warnings in the console (there is a lot of them)
        warnings: false,
      },
    }),

    // Extract CSS
    new ExtractTextPlugin({
      filename: '[name].css',
      allChunks: true
    }),

    // During beta phase, generate source maps for better errors
    new webpack.SourceMapDevToolPlugin({
      // asset matching
      test: /\.js?$/,
      exclude: /node_modules/,

      // file and reference
      filename: '[file].map',
    }),
  ],
});
/**
 *
 * (c) 2013-2016 Wishtack
 *
 * $Id: $
 */

var webpackMerge = require('webpack-merge');

/*
 * Config
 */
module.exports = webpackMerge.smart(
    require('./webpack.build-dev.config'),
    require('./webpack.common-debug.config')
);
Example #26
0
  postcss: [autoprefixer({ browsers: ['>0%'] })],
  debug: false,
  resolve: {
    alias: {
      'masonry': 'masonry-layout',
      'isotope': 'isotope-layout'
    }
  }
};

// Fix issue caused by sourcemaps
if (env === 'dev') {
  webpackConfig = merge.smart(webpackConfig, {
    output: {
      publicPath: 'http://corentinmarc/build/'
    },
    module: {
      loaders: [
        {
          test: /\.scss$/,
          include: path.join(srcPath, 'css'),
          loaders: ['style', 'css?sourceMap', 'postcss', 'sass?sourceMap']
        }
      ]
    },
    devtool: 'eval',
    debug: true
  });
}

module.exports = webpackConfig;
module.exports = _.values(Merge.smart(commonConfig, {
    web: {
        output: {
            filename: '[name].js'
        },
        devtool: 'source-map',
        plugins: [
            new webpack.LoaderOptionsPlugin({
                debug: true
            }),
            new webpack.DefinePlugin({
                'process.env.NODE_ENV': JSON.stringify('development')
            })
        ],
        module: {
            rules: [
                {
                    test: /(.scss|.css)$/,
                    include: [
                        /paragon/,
                        /font-awesome/
                    ],
                    use: [
                        'style-loader',
                        {
                            loader: 'css-loader',
                            options: {
                                sourceMap: true,
                                modules: true,
                                localIdentName: '[name]__[local]'
                            }
                        },
                        {
                            loader: 'sass-loader',
                            options: {
                                data: '$base-rem-size: 0.625; @import "paragon-reset";',
                                includePaths: [
                                    path.join(__dirname, './node_modules/@edx/paragon/src/utils'),
                                    path.join(__dirname, './node_modules/')
                                ],
                                sourceMap: true
                            }
                        }
                    ]
                }
            ]
        },
        watchOptions: {
            ignored: [/node_modules/, /\.git/]
        }
    }
}));
Example #28
0
'use strict';
const merge = require('webpack-merge');

const common = require('./webpack.common.js');


module.exports = merge.smart(common, {
	devtool: 'source-map'
});
Example #29
0
const
merge     = require('webpack-merge'),
path      = require('path'),
wp_common = require('./_config/wp_common'),
wp_plugins= require('./_config/wp_plugins');

const isProd = process.env.NODE_ENV === 'production';
const outDir = isProd ?
  path.resolve(__dirname, './dist') :
  path.resolve(__dirname, './public');



module.exports = merge.smart(wp_common, {
  output: {
    path    : outDir,
    filename: '[name].[hash].js',
  },
  plugins: wp_plugins(outDir, isProd)
});
Example #30
0
 const getCompleteConfig = (incompleteConfig) => merge.smart(config, incompleteConfig)