Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import VueSSRPlugin from 'vue-ssr-webpack-plugin';
// when output cache is enabled generate cache version key
import config from 'config';
import fs from 'fs';
import path from 'path';
import uuid from 'uuid/v4';
if (config.server.useOutputCache) {
fs.writeFileSync(
path.join(__dirname, 'cache-version.json'),
JSON.stringify(uuid())
);
}
export default merge(base, {
mode: 'development',
target: 'node',
entry: ['@babel/polyfill', './core/server-entry.ts'],
output: {
filename: 'server-bundle.js',
libraryTarget: 'commonjs2'
},
resolve: {
alias: {
'create-api': './create-api-server.js'
}
},
externals: Object.keys(require('../../package.json').dependencies),
plugins: [
new webpack.DefinePlugin({
'process.env.VUE_ENV': '"server"'
import { resolve } from 'path';
import MinifyPlugin from 'babel-minify-webpack-plugin';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import * as webpack from 'webpack';
import webpackMerge from 'webpack-merge';
import base from './main.base.config.babel';
export default webpackMerge(base, {
bail: true,
plugins: [
new webpack.DefinePlugin({
'__isDev__': JSON.stringify(false),
}),
new webpack.optimize.ModuleConcatenationPlugin(),
new CleanWebpackPlugin(['app/main.js'], { root: resolve(__dirname, '..') }),
//new MinifyPlugin()
// new webpack.optimize.UglifyJsPlugin()
],
});
import path from 'path'
import webpack from 'webpack'
import webpackMerge from 'webpack-merge'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import BrowserSyncPlugin from 'browser-sync-webpack-plugin'
import webpackConfigBase from './config.base.babel'
import {CURRENT_IP, WEBPACK_SERVER_PORT, BROWSER_SYNC_PORT, projectSourcePath, templatePath} from '../config'
const externalPath = `http://${CURRENT_IP}:${WEBPACK_SERVER_PORT}/`
export default webpackMerge(webpackConfigBase, {
devtool: 'eval',
entry: {
app: [
// fix HMR in IE
'eventsource-polyfill',
// allow HMR in this entry point, with correct path
`webpack-hot-middleware/client?reload=true&path=${externalPath}__webpack_hmr`,
// force page reload when html-webpack-plugin template changes
path.resolve(__dirname, './client.js'),
path.join(projectSourcePath, 'app/main.js')
]
},
output: {
publicPath: externalPath, // chunks works calling js from external server
filename: '[name].js',
await fs.copy(manifestPath, path.resolve(outDir, 'manifest.json'))
const done = loggingHelper.timed(`building service ${serviceName}`)
const defineFields = {}
if (prod) {
defineFields['process.env.CHATPLUG_DASHBOARD_STATIC_DIR'] = "require('path').join(__dirname, '../../dashboard-web')"
} else {
defineFields['process.env.CHATPLUG_DASHBOARD_DEV_HTTP_HANDLER'] = JSON.stringify(
path.resolve(
__dirname,
'../src/services/dashboard/web/dashboardHttpHandler',
),
)
}
return webpack(
merge(baseWebpackConfig, {
entry: path.resolve(sourcePath, 'index.ts'),
name: serviceName,
output: {
path: outDir,
filename: 'index.js',
library: serviceName,
libraryTarget: 'commonjs2',
},
plugins: [
new webpack.DllReferencePlugin({
name: '../../chatplug.lib',
context: path.resolve(__dirname, '../'),
manifest: path.resolve(
__dirname,
'../dist/chatplug.lib.manifest.json',
),
import webpack from 'webpack'
import merge from 'webpack-merge'
import baseConfig from '../webpack.config.base'
export default merge(baseConfig, {
devtool: 'source-map',
entry: ['babel-polyfill', './main.dev'],
output: {
path: __dirname,
filename: '../main.js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new webpack.BannerPlugin(
import path from 'path';
import webpack from 'webpack';
import merge from 'webpack-merge';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import baseConfig from './base.config.js';
import { cssExtractLoaders } from '../support/utils.js';
import FormatHtmlPlugin from '../support/formatHtml.js';
import baseWebpackConfig from './webpack.base.config.js';
let webpackConfig = {};
webpackConfig = merge(baseWebpackConfig, {
vue: {
loaders: cssExtractLoaders({
extract: true
})
},
output: {
path: baseConfig.build.staticRoot,
filename: 'dist/js/[name].[chunkhash].js',
chunkFilename: 'dist/js/[id].[chunkhash].js'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
import merge from 'webpack-merge';
import webpack from 'webpack';
import CompressionPlugin from 'compression-webpack-plugin';
import CleanPlugin from 'clean-webpack-plugin';
import commonConfig from './webpack-common.config.js';
export default merge(commonConfig, {
debug: false,
devtool: "source-map",
profile: true,
watch: false,
plugins: [
new CleanPlugin(["build"]),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
BROWSER: JSON.stringify(true),
},
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(true),
plugins: [
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false,
drop_console: true,
},
mangle: {
screw_ie8 : true,
},
}),
],
}
return [
prod,
merge(prod, min),
]
}
const mergeAliasToConfig = ({ alias = {}, config = {} }) => {
const result = merge(
config,
filterUndefined({
output: alias.output,
entry: alias.entry,
externals: alias.externals,
watch: alias.watch,
watchOptions: alias.watchOptions,
resolve: {
alias: alias.alias,
},
}),
);
result.plugins = result.plugins || [];
alias.define && result.plugins.push(new webpack.DefinePlugin(alias.define));
alias.provide && result.plugins.push(new webpack.ProvidePlugin(alias.provide));
return result;
import path from 'path'
import merge from 'webpack-merge'
import CopyPlugin from 'copy-webpack-plugin'
import { commonConfig } from './webpack.common'
import pkg from '../package.json'
export default merge(commonConfig, {
mode: 'development',
entry: {
'scripts/hotReload': path.resolve(
__dirname,
'../node_modules/crx-hotreload/hot-reload.js'
)
},
plugins: [
new CopyPlugin([
{
from: './src/manifest.json',
to: '.',
transform: (content: Buffer) => {
const manifest = JSON.parse(content.toString())
const background = manifest.background || {}
const scripts = background.scripts || []