Я работаю над решением для машинописного текста, которое будет иметь несколько точек входа.В моем решении я использую некоторые внешние библиотеки.Я использую webpack + ts-loader для компиляции и комплектации.Теперь, если я включу все внешние зависимости, тогда мое решение работает отлично.Сейчас я пытаюсь выяснить способы исключения внешних библиотек из моего комплекта и загрузки их из CDN.Я погуглил и вижу, что мне нужно включить требуемый конфиг и добавить туда пути CDN.Но я не могу понять, как я могу убедиться, что требуемый файл конфигурации добавлен в мой комплект.Мой webpack.config ниже:
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const SPSaveWebpackPlugin = require('spsave-webpack-plugin');
module.exports = {
entry: {
helloworld:'./app/helloworld/helloworld.ts',
weather:'./app/weather/weather.ts'
},
module: {
rules: [
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: [ '.ts', '.js' ]
},
target: "node",
externals:{},
output: {
publicPath:'https://siteurl/Style Library/webparts', // to get correct path inside sharepoint
filename: '[name]-bundle.js',
path: path.resolve(__dirname, 'dist')
},
plugins: [
new HtmlWebpackPlugin({ // Also generate a test.html
filename: 'helloworld.html', // name of the output file
chunks:['helloworld'], // name of the entry point defined above
template: './app/helloworld/helloworld.html' // path to the html for the webpart
}),
new HtmlWebpackPlugin({ // Also generate a test.html
filename: 'weather.html', // name of the output file
chunks:['weather'], // name of the entry point defined above
template: './app/weather/weather.html' // path to the html for the webpart
}),
new SPSaveWebpackPlugin({
"coreOptions": {
"checkin": true,
"checkinType": 1,
"siteUrl": "https://siteurl"
},
"credentialOptions": null,
"fileOptions": {
"folder": "Style Library/webparts"
}
})]
};
Пример решения в моем репо здесь