Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Шаблон 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