Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance.
const webpackTask: WebpackTask = require('@microsoft/web-library-build').webpack;
const webpack: typeof Webpack = webpackTask.resources.webpack;
const isProduction: boolean = webpackTask.buildConfig.production;
// eslint-disable-next-line
const packageJSON: { name: string } = require('./package.json');
const webpackConfiguration: Webpack.Configuration = {
context: __dirname,
devtool: (isProduction) ? undefined : 'source-map',
entry: {
[packageJSON.name]: path.join(__dirname, webpackTask.buildConfig.libFolder, 'index.js')
},
output: {
libraryTarget: 'umd',
path: path.join(__dirname, webpackTask.buildConfig.distFolder),
filename: `[name]${isProduction ? '.min' : ''}.js`
},
// The typings are missing the "object" option here (https://webpack.js.org/configuration/externals/#object)
externals: {
'react': {
amd: 'react',
commonjs: 'react'
},
'react-dom': {
amd: 'react-dom',
import * as Webpack from 'webpack';
// @ts-ignore
import * as WebpackDevServer from 'webpack-dev-server'; // eslint-disable-line
import { WebpackTask } from './WebpackTask';
import * as path from 'path';
// Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance.
const webpackTask: WebpackTask = require('@microsoft/web-library-build').webpack;
const webpack: typeof Webpack = webpackTask.resources.webpack;
const isProduction: boolean = webpackTask.buildConfig.production;
// eslint-disable-next-line
const packageJSON: { name: string } = require('./package.json');
const webpackConfiguration: Webpack.Configuration = {
context: __dirname,
devtool: (isProduction) ? undefined : 'source-map',
entry: {
[packageJSON.name]: path.join(__dirname, webpackTask.buildConfig.libFolder, 'index.js')
},
output: {
libraryTarget: 'umd',
path: path.join(__dirname, webpackTask.buildConfig.distFolder),
filename: `[name]${isProduction ? '.min' : ''}.js`