Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'react-sortable-hoc',
'prop-types',
'react-waypoint',
'angular',
'classnames',
'combokeys',
'moment',
'simply-uuid',
'sniffr'
]
},
// Webpack config part
devtool,
module: {
rules: [
webpackConfig.loaders.whatwgLoader
]
},
plugins: optimizePlugins
})
]
};
return docsWebpackConfig;
};
console.log('__dirname', path.resolve(__dirname, '../..'))
// needed in examples
alias: {
'@ring-ui/docs': __dirname,
'@jetbrains/logos': require('@jetbrains/logos'),
'@jetbrains/ring-ui': ringUiPath
}
},
context: ringUiPath,
module: {
rules: [
...webpackConfig.config.module.rules,
// HTML examples
{
test: /example\.html$/,
use: extractHTML.extract({
use: webpackConfig.loaders.htmlLoader.loader
})
},
// CSS examples
{
test: exampleCssPattern,
use: extractCSS.extract({
// no need to emit results, we inline them manually in twig template
disable: true,
use: cssLoader
})
},
// twig templates
{
test: /\.twig$/,
loader: 'twig-loader'
}
const devtool = production ? false : 'cheap-eval-source-map';
const dllPath = `dll-${envString}`;
const optimizePlugins = production
? [
new webpack.DefinePlugin(envDefinition),
new webpack.optimize.UglifyJsPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true
})
]
: [];
const exampleCssPattern = /example?\.css$/;
const [, ...cssLoader] = webpackConfig.loaders.cssLoader.use;
// Patch cssLoader to avoid using it on examples' styles
webpackConfig.loaders.cssLoader.exclude = exampleCssPattern;
const extractCSS = new ExtractTextPlugin('examples/[name]/[hash].css');
const extractHTML = new ExtractTextPlugin('examples/[name]/[hash].html');
const getParam = name => (
env[name] ||
process.env[`npm_package_config_${name}`] ||
process.env[`npm_package_config_${envString}_${name}`] ||
pkgConfig[name] ||
pkgConfig[envString][name]
);
const port = Number(getParam('port'));
const host = getParam('host');
const serverUri = getParam('hub');
const clientId = getParam('clientId');
}
};
const devtool = production ? false : 'cheap-eval-source-map';
const dllPath = `dll-${envString}`;
const optimizePlugins = production
? [
new webpack.DefinePlugin(envDefinition),
new webpack.optimize.UglifyJsPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true
})
]
: [];
const exampleCssPattern = /example?\.css$/;
const [, ...cssLoader] = webpackConfig.loaders.cssLoader.use;
// Patch cssLoader to avoid using it on examples' styles
webpackConfig.loaders.cssLoader.exclude = exampleCssPattern;
const extractCSS = new ExtractTextPlugin('examples/[name]/[hash].css');
const extractHTML = new ExtractTextPlugin('examples/[name]/[hash].html');
const getParam = name => (
env[name] ||
process.env[`npm_package_config_${name}`] ||
process.env[`npm_package_config_${envString}_${name}`] ||
pkgConfig[name] ||
pkgConfig[envString][name]
);
const port = Number(getParam('port'));
const host = getParam('host');
const serverUri = getParam('hub');
const createEntriesList = require('./create-entries-list');
// Borrowed from webpack-dev-server
const colorInfo = msg => `\u001b[1m\u001b[34m${msg}\u001b[39m\u001b[22m`;
const ringUiPath = path.dirname(
require.resolve('@jetbrains/ring-ui/package.json')
);
const publicPath = '/';
const distDir = 'dist';
const contentBase = path.resolve(__dirname, distDir);
const siteComponents = path.resolve(__dirname, 'components');
// For docs-app entry point
webpackConfig.componentsPath.push(siteComponents);
webpackConfig.loaders.svgSpriteLoader.include.push(
require('@jetbrains/logos'),
path.dirname(require.resolve('octicons/package.json'))
);
module.exports = (env = {}) => {
const {server, production} = env;
const envString = production ? 'production' : 'development';
const envDefinition = {
'process.env': {
NODE_ENV: JSON.stringify(envString)
}
};
const devtool = production ? false : 'cheap-eval-source-map';
const dllPath = `dll-${envString}`;
const optimizePlugins = production
? [
'prop-types',
'react-waypoint',
'angular',
'classnames',
'combokeys',
'moment',
'simply-uuid',
'sniffr'
]
},
dllDir: path.join(contentBase, dllPath),
webpackConfig: {
devtool,
module: {
rules: [
webpackConfig.loaders.whatwgLoader
]
},
plugins: optimizePlugins // DllBundlesPlugin will set the DllPlugin here
}
})
]
};
return docsWebpackConfig;
};
const createEntriesList = require('./create-entries-list');
// Borrowed from webpack-dev-server
const colorInfo = msg => `\u001b[1m\u001b[34m${msg}\u001b[39m\u001b[22m`;
const ringUiPath = path.dirname(
require.resolve('@jetbrains/ring-ui/package.json')
);
const publicPath = '/';
const distDir = 'dist';
const contentBase = path.resolve(__dirname, distDir);
const siteComponents = path.resolve(__dirname, 'components');
// For docs-app entry point
webpackConfig.componentsPath.push(siteComponents);
webpackConfig.loaders.svgSpriteLoader.include.push(
require('@jetbrains/logos'),
path.dirname(require.resolve('octicons/package.json'))
);
module.exports = (env = {}) => {
const {server, production} = env;
const envString = production ? 'production' : 'development';
const envDefinition = {
'process.env': {
NODE_ENV: JSON.stringify(envString)
}
};
const devtool = production ? false : 'cheap-eval-source-map';
const dllPath = `dll-${envString}`;
const optimizePlugins = production
? [
modules: [path.resolve(ringUiPath, 'node_modules')],
// needed in examples
alias: {
'@ring-ui/docs': __dirname,
'@jetbrains/ring-ui': ringUiPath
}
},
context: ringUiPath,
module: {
rules: [
...webpackConfig.config.module.rules,
// HTML examples
{
test: /example\.html$/,
use: extractHTML.extract({
use: webpackConfig.loaders.htmlLoader.loader
})
},
// CSS examples
{
test: exampleCssPattern,
use: extractCSS.extract({
// no need to emit results, we inline them manually in twig template
disable: true,
use: cssLoader
})
},
// twig templates
{
test: /\.twig$/,
loader: 'twig-loader'
}