How to use the @microsoft/web-library-build.webpack function in @microsoft/web-library-build

To help you get started, we’ve selected a few @microsoft/web-library-build examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / rushstack / core-build / gulp-core-build-webpack / src / webpack.config.ts View on Github external
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: {
github OfficeDev / office-ui-fabric-react / packages / experiments / webpack.lib.config.js View on Github external
'use strict';

/** Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance. */
let build = require('@microsoft/web-library-build');
let webpackTaskResources = build.webpack.resources;
let webpack = webpackTaskResources.webpack;
let path = require('path');
let buildConfig = build.getConfig();
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

const BUNDLE_NAME = 'experiments';
const BUNDLE_TEST = 'fabric-test';
const IS_PRODUCTION = process.argv.indexOf('--production') > -1;

// Create an array of configs, prepopulated with a debug (non-minified) build.
let configs = [
  createConfig(false)
];

// Create a production config if applicable.
if (IS_PRODUCTION) {
github OfficeDev / office-ui-fabric-react / packages / merge-styles / gulpfile.js View on Github external
'use strict';

let gulp = require('gulp');
let build = require('@microsoft/web-library-build');

build.task('tslint', build.tslint);
build.task('sass', build.sass);
build.task('karma', build.karma);
build.task('webpack', build.webpack);

// initialize tasks.
build.initialize(gulp);

// Always fail on test failures.
build.karma.setConfig({
  failBuildOnErrors: true
});
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / gulpfile.js View on Github external
// Copy fabric-core to dist to be published with fabric-react.
build.preCopy.setConfig({
  shouldFlatten: false,
  copyTo: {
    [path.join(distFolder, 'sass')]: [
      'node_modules/office-ui-fabric-core/dist/sass/**/*.*'
    ],
    [path.join(distFolder, 'css')]: [
      'node_modules/office-ui-fabric-core/dist/css/**/*.*'
    ]
  }
});

// Short aliases for subtasks.
build.task('webpack', build.webpack);
build.task('tslint', build.tslint);
build.task('ts', build.typescript);
build.task('sass', build.serial(build.preCopy, build.sass));
build.task('karma', build.karma);
build.task('test', serial(build.sass, build.typescript, build.karma));
// build.task('visualtest', serial(build.sass, build.typescript, build.webpack, visualTestClean, visualTest));

// initialize tasks.
build.initialize(gulp);
github OfficeDev / office-ui-fabric-react / packages / office-ui-fabric-react / webpack.demo.config.js View on Github external
'use strict';

/** Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance. */
let build = require('@microsoft/web-library-build');
let buildConfig = build.getConfig();
let webpackTaskResources = build.webpack.resources;
let webpack = webpackTaskResources.webpack;

let path = require('path');
let SplitByPathPlugin = require('webpack-split-by-path');
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

// Create an array of configs, prepopulated with a debug (non-minified) build.
let configs = [
  createConfig(false)
];

// Create a production config if applicable.
if (process.argv.indexOf('--production') > -1) {
  configs.push(createConfig(true));
}
github OfficeDev / office-ui-fabric-react / webpack.lib.config.js View on Github external
'use strict';

/** Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance. */
let build = require('@microsoft/web-library-build');
let webpackTaskResources = build.webpack.resources;
let webpack = webpackTaskResources.webpack;
let path = require('path');
let VisualizerPlugin = require('webpack-visualizer-plugin');
let buildConfig = build.getConfig();

// Create an array of configs, prepopulated with a debug (non-minified) build.
let configs = [
  createConfig(false)
];

// Create a production config if applicable.
if (process.argv.indexOf('--production') > -1) {
  configs.push(createConfig(true));
}

// Helper to create the config.
github OfficeDev / office-ui-fabric-react / apps / fabric-examples / webpack.config.js View on Github external
'use strict';

/** Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance. */
let build = require('@microsoft/web-library-build');
let buildConfig = build.getConfig();
let webpackTaskResources = build.webpack.resources;
let webpack = webpackTaskResources.webpack;
let path = require('path');
let SplitByPathPlugin = require('webpack-split-by-path');
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;

const IS_PRODUCTION = process.argv.indexOf('--production') >= 0;
const BUNDLE_NAME = 'fabric-examples';

// Create an array of configs, prepopulated with a debug (non-minified) build.
let configs = [
  createConfig(IS_PRODUCTION)
];

// Helper to create the config.
function createConfig(isProduction) {
  let minFileNamePart = isProduction ? '.min' : '';
github OfficeDev / office-ui-fabric-react / apps / fabric-website / webpack.site.config.js View on Github external
'use strict';

/** Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance. */
let webpackTaskResources = require('@microsoft/web-library-build').webpack.resources;
let webpack = webpackTaskResources.webpack;
let BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
let isProduction = process.argv.indexOf('--production') > -1;
let isDogfood = process.argv.indexOf('--dogfood') > -1;
let path = require('path');
const version = require('./package.json').version;

let publicPath = 'https://static2.sharepointonline.com/files/fabric/fabric-website/dist/';

if (isDogfood) {
  publicPath = 'https://static2df.sharepointonline.com/files/fabric/fabric-website/dist/';
} else if (!isProduction) {
  publicPath = "/dist/";
}

// Create an array of configs, prepopulated with a debug (non-minified) build.
github microsoft / rushstack / core-build / test-web-library-build / gulpfile.js View on Github external
'use strict';

let path = require('path');
let build = require('@microsoft/web-library-build');

build.sass.setConfig({ useCSSModules: true });
build.webpack.setConfig({ configPath: null });

build.setConfig({
  libAMDFolder: path.join(build.getConfig().packageFolder, 'lib-amd'),
  libES6Folder: path.join(build.getConfig().packageFolder, 'lib-es6')
});

build.preCopy.cleanMatch = ['src/preCopyTest.ts'];

build.initialize(require('gulp'));
github microsoft / rushstack / core-build / gulp-core-build-webpack / webpack.config.js View on Github external
'use strict';

/** Note: this require may need to be fixed to point to the build that exports the gulp-core-build-webpack instance. */
let webpackTaskResources = require('@microsoft/web-library-build').webpack.resources;
let webpack = webpackTaskResources.webpack;

let path = require('path');
let isProduction = process.argv.indexOf('--production') > -1;
let packageJSON = require('./package.json');

let webpackConfig = {
  context: path.join(__dirname, 'lib/'),

  entry: {
    [packageJSON.name]: './index.js'
  },

  output: {
    libraryTarget: 'umd',
    path: path.join(__dirname, '/dist'),