-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Editor: fix bugs, enable in demo app, update Monaco (#10973)
* Update Monaco and enable editor in OUFR demo app * Change files * specify raw-loader dep * Fix invalid hook error
- Loading branch information
1 parent
d78a5c1
commit d2ddc7b
Showing
24 changed files
with
191 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,9 @@ | ||
import { createDemoApp } from '@uifabric/example-app-base'; | ||
import { configureEnvironment } from '@uifabric/tsx-editor'; | ||
import { AppDefinition } from './AppDefinition'; | ||
import { GettingStartedPage } from './GettingStartedPage'; | ||
|
||
// Configure example editor | ||
configureEnvironment({ baseUrl: '.', useMinified: false }); | ||
|
||
createDemoApp(AppDefinition, GettingStartedPage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
let path = require('path'); | ||
const resources = require('../../scripts/webpack/webpack-resources'); | ||
const resources = require('@uifabric/build/webpack/webpack-resources'); | ||
const { addMonacoWebpackConfig } = require('@uifabric/tsx-editor/scripts/addMonacoWebpackConfig'); | ||
|
||
const BUNDLE_NAME = 'office-ui-fabric-react'; | ||
const IS_PRODUCTION = process.argv.indexOf('--production') > -1; | ||
|
||
module.exports = [ | ||
...resources.createConfig(BUNDLE_NAME, IS_PRODUCTION, { | ||
entry: { [BUNDLE_NAME]: './lib/index.bundle.js' }, | ||
...resources.createConfig( | ||
BUNDLE_NAME, | ||
IS_PRODUCTION, | ||
addMonacoWebpackConfig({ | ||
entry: { [BUNDLE_NAME]: './lib/index.js' }, | ||
|
||
output: { | ||
libraryTarget: 'var', | ||
library: 'Fabric' | ||
}, | ||
|
||
externals: [ | ||
{ | ||
react: 'React' | ||
output: { | ||
libraryTarget: 'var', | ||
library: 'Fabric' | ||
}, | ||
{ | ||
|
||
externals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM' | ||
} | ||
], | ||
}, | ||
|
||
resolve: { | ||
alias: { | ||
'office-ui-fabric-react$': path.resolve(__dirname, '../../packages/office-ui-fabric-react/lib'), | ||
'office-ui-fabric-react/src': path.resolve(__dirname, '../../packages/office-ui-fabric-react/src'), | ||
'office-ui-fabric-react/lib': path.resolve(__dirname, '../../packages/office-ui-fabric-react/lib'), | ||
'@uifabric/api-docs/lib': path.resolve(__dirname, '../../packages/api-docs/lib'), | ||
'Props.ts.js': 'Props', | ||
'Example.tsx.js': 'Example' | ||
resolve: { | ||
alias: { | ||
'office-ui-fabric-react$': path.resolve(__dirname, '../../packages/office-ui-fabric-react/lib'), | ||
'office-ui-fabric-react/src': path.resolve(__dirname, '../../packages/office-ui-fabric-react/src'), | ||
'office-ui-fabric-react/lib': path.resolve(__dirname, '../../packages/office-ui-fabric-react/lib'), | ||
'@uifabric/api-docs/lib': path.resolve(__dirname, '../../packages/api-docs/lib'), | ||
'Props.ts.js': 'Props', | ||
'Example.tsx.js': 'Example' | ||
} | ||
} | ||
} | ||
}), | ||
}) | ||
), | ||
require('./webpack.serve.config') | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,22 @@ | ||
const getResolveAlias = require('../../scripts/webpack/getResolveAlias'); | ||
const resources = require('../../scripts/webpack/webpack-resources'); | ||
const getResolveAlias = require('@uifabric/build/webpack/getResolveAlias'); | ||
const resources = require('@uifabric/build/webpack/webpack-resources'); | ||
const { addMonacoWebpackConfig } = require('@uifabric/tsx-editor/scripts/addMonacoWebpackConfig'); | ||
|
||
module.exports = resources.createServeConfig({ | ||
entry: './src/index.tsx', | ||
const BUNDLE_NAME = 'demo-app'; | ||
|
||
output: { | ||
filename: 'demo-app.js' | ||
}, | ||
module.exports = resources.createServeConfig( | ||
addMonacoWebpackConfig({ | ||
entry: { | ||
[BUNDLE_NAME]: './src/index.tsx' | ||
}, | ||
|
||
externals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM' | ||
}, | ||
externals: { | ||
react: 'React', | ||
'react-dom': 'ReactDOM' | ||
}, | ||
|
||
resolve: { | ||
alias: getResolveAlias() | ||
} | ||
}); | ||
resolve: { | ||
alias: getResolveAlias() | ||
} | ||
}) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
change/@uifabric-fabric-website-2019-10-26-12-51-04-tsx-fix.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Add missing tsx-editor dev dep", | ||
"packageName": "@uifabric/fabric-website", | ||
"email": "[email protected]", | ||
"commit": "da81d25a70517a242b31f2b25ee8b07975b6e539", | ||
"date": "2019-10-26T19:41:23.322Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/@uifabric-fabric-website-resources-2019-10-26-12-51-04-tsx-fix.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Enable live editor and update bundling", | ||
"packageName": "@uifabric/fabric-website-resources", | ||
"email": "[email protected]", | ||
"commit": "da81d25a70517a242b31f2b25ee8b07975b6e539", | ||
"date": "2019-10-26T19:41:10.088Z" | ||
} |
8 changes: 8 additions & 0 deletions
8
change/@uifabric-monaco-editor-2019-10-26-12-51-04-tsx-fix.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "minor", | ||
"comment": "Pick up new Monaco version and try a different cross-domain worker loading method", | ||
"packageName": "@uifabric/monaco-editor", | ||
"email": "[email protected]", | ||
"commit": "da81d25a70517a242b31f2b25ee8b07975b6e539", | ||
"date": "2019-10-26T19:41:34.548Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"type": "patch", | ||
"comment": "Fix some minor bugs", | ||
"packageName": "@uifabric/tsx-editor", | ||
"email": "[email protected]", | ||
"commit": "da81d25a70517a242b31f2b25ee8b07975b6e539", | ||
"date": "2019-10-26T19:51:04.006Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,11 +20,25 @@ function addMonacoWebpackConfig(config, includeAllLanguages) { | |
throw new Error('config passed to addMonacoConfig must be an object, not an array or function.'); | ||
} | ||
|
||
const { entry, output, resolve } = config; | ||
const { entry, output, externals, resolve } = config; | ||
if (!entry || typeof entry !== 'object') { | ||
throw new Error(`config.entry passed to addMonacoWebpackConfig must be an object. Got: ${JSON.stringify(entry)}`); | ||
} | ||
|
||
// As of [email protected], typescriptServices.js includes a direct require for this package, | ||
// which breaks webpack. Use an external to get rid of it (this works since the require is | ||
// wrapped in a try/catch). Will be fixed once this merges and is published. | ||
// https://github.com/microsoft/monaco-typescript/pull/49 | ||
/** @type {webpack.ExternalsElement[]} */ | ||
const newExternals = [{ '@microsoft/typescript-etw': 'FakeModule' }]; | ||
if (externals) { | ||
if (Array.isArray(externals)) { | ||
newExternals.push(...externals); | ||
} else { | ||
newExternals.push(externals); | ||
} | ||
} | ||
|
||
// Somewhat based on https://github.com/microsoft/monaco-editor/blob/master/docs/integrate-esm.md | ||
return { | ||
...config, | ||
|
@@ -40,6 +54,7 @@ function addMonacoWebpackConfig(config, includeAllLanguages) { | |
} | ||
: {}) | ||
}, | ||
externals: newExternals, | ||
output: { | ||
...output, | ||
globalObject: 'self' // required for monaco--see https://github.com/webpack/webpack/issues/6642 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.