Skip to content

Commit dec02f1

Browse files
authored
Merge pull request #258 from laggage/fix-compile-markdown-entry
chore: fix compile markdown.entry.ts
2 parents 1c6dc32 + 0674654 commit dec02f1

File tree

3 files changed

+15
-7
lines changed

3 files changed

+15
-7
lines changed

ui/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
"@/*": ["../src/*"]
1717
},
1818
"lib": ["DOM", "ES2020"],
19-
"strictBindCallApply": true
19+
"strictBindCallApply": true,
20+
"rootDir": "../"
2021
},
2122
"include": ["./**/*.ts", "./**/*.tsx", "./**/*.jsx", "./**/*.js", "*.mjs", "../src/model/*.ts"],
2223
"exclude": ["./dist"]

ui/webpack.config.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const buildEntry = () => {
1818
.filter(x => x.isDirectory() && !['share', 'dist', 'lib'].includes(x.name))
1919
.map(x => x.name)
2020
for (let folder of folders) {
21-
const key = `${folder}/index`
21+
const key = `assets/ui/${folder}/index`
2222
entries[key] = `./ui/${folder}/index.tsx`
2323
cpSync(`./ui/${folder}/index.html`, `./dist/assets/ui/${folder}/index.html`, { force: true })
2424
}
@@ -28,8 +28,8 @@ const buildEntry = () => {
2828

2929
cpSync('./node_modules/@fluentui/font-icons-mdl2/fonts/', './dist/assets/fonts/', { recursive: true })
3030

31-
if (isDevEnv) console.log(entries)
32-
31+
entries['markdown'] = './src/markdown/markdown.entry.ts'
32+
console.log(entries)
3333
return entries
3434
}
3535

@@ -39,15 +39,16 @@ const buildEntry = () => {
3939
const config = {
4040
entry: buildEntry(),
4141
output: {
42-
path: path.resolve('dist/assets/ui'), //打包后的文件存放的地方
42+
path: path.resolve('dist'), //打包后的文件存放的地方
4343
filename: '[name].js', //打包后输出文件的文件名
4444
},
4545
resolve: {
46-
extensions: ['.tsx', '.ts', 'less', '.css', '.js'],
46+
extensions: ['.tsx', '.ts', 'less', '.css', '.js', '.mjs'],
4747
plugins: [new TsconfigPathsPlugin({ configFile: './ui/tsconfig.json' })],
4848
},
4949
devtool: isDevEnv ? 'eval-source-map' : false,
5050
mode: isDevEnv ? 'development' : 'production',
51+
target: 'web',
5152
module: {
5253
rules: [
5354
{
@@ -94,6 +95,12 @@ const config = {
9495
test: /\.tsx?$/,
9596
use: 'ts-loader',
9697
},
98+
{
99+
test: /\.mjs/,
100+
resolve: {
101+
fullySpecified: false,
102+
},
103+
},
97104
],
98105
},
99106
performance: {

webpack.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default (env, { mode }) => {
5252
target: 'node', // vscode extensions run in a Node.js-context 📖 -> https://webpack.js.org/configuration/node/
5353
mode: mode, // this leaves the source code as close as possible to the original (when packaging we set this to 'production')
5454

55-
entry: { extension: './src/extension.ts', markdown: './src/markdown/markdown.entry.ts' }, // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
55+
entry: { extension: './src/extension.ts' }, // the entry point of this extension, 📖 -> https://webpack.js.org/configuration/entry-context/
5656
output: {
5757
// the bundle is stored in the 'dist' folder (check package.json), 📖 -> https://webpack.js.org/configuration/output/
5858
path: path.resolve(__dirname, 'dist'),

0 commit comments

Comments
 (0)