Skip to content

Instantly share code, notes, and snippets.

@TheHatSky
Last active January 8, 2017 12:09
Show Gist options
  • Save TheHatSky/5c8c3f6e55b3639a0b157ce74bedaba2 to your computer and use it in GitHub Desktop.
Save TheHatSky/5c8c3f6e55b3639a0b157ce74bedaba2 to your computer and use it in GitHub Desktop.
Шаблон webpack.config.part.js
'use strict';
module.exports = (basePath, requirements) => {
const path = requirements.path;
const baseDir = path.join(basePath, 'Scripts' , 'webpack');
return {
entry: {
// Путь к файлу относительно папки проекта: ./Scripts/webpack/dialog/dialog.tsx.
'dialog': path.join(baseDir, 'dialog', 'dialog.tsx')
},
output: {
// Положим все в папку ./dist.
path: path.join(baseDir, 'dist'),
// Для entry 'dialog' будет 'dialog.bundle.js'.
filename: '[name].bundle.js',
sourceMapFilename: '[name].js.map'
},
externals: {
// В данном случае импорты "react", "react-dom" и "react-dom-server" будут заменены
// на использование глобальных перменных "React", "ReactDOM" и "ReactDOMServer" соответственно.
"react": "React",
"react-dom": "ReactDOM",
"react-dom-server": "ReactDOMServer"
}
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment