Comments (10)
Hmm good catch let me look at that. file-loader
marks file paths and serves them as is. We want to avoid that and bundle the html code as a template string in JavaScript
.
from office-js-helpers.
This does indeed seem to now be working correctly. Using source-map-explorer, I can see that all of lodash is no longer being included, and @microsoft/office-js-helpers
has gotten slightly larger (because it is now including the parts of lodash it needs, presumably).
Those are uncompressed file sizes. After compression, switching from 0.7.4 to 0.8.0-beta.3 caused my bundle size to decrease by 18.89 KB. Not bad! Thanks for taking the time to improve this. 👍 0.8.0-beta.3 is working well.
from office-js-helpers.
Are you using es6 import? If so then that's addressed now in the new build as I included the html file in the compiled output. Otherwise, the html template has already been stringified and included.
from office-js-helpers.
the new version is 0.8.0-beta.2
from office-js-helpers.
Yes I am using es6 imports:
import {Authenticator} from '@microsoft/office-js-helpers';
I just gave beta.2 a shot, and am now getting this error:
./~/@microsoft/office-js-helpers/dist/ui/message-banner.html
Module parse failed: node_modules/@microsoft/office-js-helpers/dist/ui/message-banner.html Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| <div class="office-js-helpers-notification ms-font-m ms-MessageBar @@CLASS">
| <style>
| .office-js-helpers-notification {
error Command failed with exit code 1.
I believe this is because my webpack config is set up to only be used on my own files, and not on node_modules
. So, the require
is treating the html file as if it were JavaScript.
from office-js-helpers.
Let me try it out with the angular & react starter kits and get back to you. If it works then I think we'll need to investigate your config further.
from office-js-helpers.
Thanks for looking into it.
Normally it is expected that node_modules contain compiled files that do not require further processing or the use of a a particular bundler like webpack in order to be used within the intended target environment. Requiring an html file is not something that node or javascript generally knows how to deal with, without the use of something like webpack. I don't think that asking consumers of this library to change their webpack configs (or start using webpack) to handle the particular needs of this package is the way to go.
from office-js-helpers.
Yup and I agree. What I am trying to achieve is the same actually. I don't expect node or javascript to import html. It was meant for webpack to pick it up. That said, I am not sure why its trying to do something like that in your build and hence I suggested that something might be funny there.
What I was expecting is office.helpers.js
is given to webpack and it sees a require statement for a module named template.html
and we define a fake module called template.html
that just exports a variable containing the entire html string.
from office-js-helpers.
Here's a new build of the library - https://unpkg.com/@microsoft/[email protected]/dist/office.helpers.js.
It includes a bunch of optimizations on how the Storage
module works and also fixes the webpack loading problem. Problem was that webpack was using the source files to recompile the library but with the new tree shaking capabilities of webpack this is no longer needed. If you see the dist folder now as only the required files.
from office-js-helpers.
Thanks for taking a look. I'll do some more testing and will be publishing the new version. Some new features are going to be added in as well.
from office-js-helpers.
Related Issues (20)
- Google auth dialog showing "403 diallowed_useragent" HOT 1
- `plus.me` scope does not return email of user HOT 2
- OfficeHelpers.UI.notify has no background color in a React-based Office Add-in HOT 1
- office-js-helper with IdentityServer? HOT 1
- Double clicking the 'Allow' button on the dialog consent form in Word Online launches two dialogs HOT 1
- Office helpers gives undefined exception on Word 2016 HOT 3
- Storage.has(key) returns true even when the key actually doesn't exist.
- Missing any login dialog
- redirectUrl problem HOT 1
- Edge authentication popup doesn't close HOT 1
- IsAddin check fails in Browser, still returns true and uses Dialog framework HOT 3
- Authentication dialog not closing in Office Online on IE11(11.706.17134.0)
- Unable to delete 'AzureAD' from storage HOT 1
- redirect and automatically closing authentication dialog and token issue (MAC safari)
- Office Addin for Powerpoint : Dialog & authentication issue.
- Office Version 1907 / Windows 1903 - Authentication Redirect HOT 4
- feature request: Store token in OfficeRuntime.Storage HOT 1
- Authenticator: Make width and height of dialog window configurable
- State couldn't be verified
- displayDialogAsync does work in vanilla js but doesn't with react HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from office-js-helpers.