Comments (5)
Encountered the same problem after upgrading from Ember 3.17
to 3.21
. The unprocessed version of the initializer is included in the production build resulting in error Uncaught SyntaxError: Unexpected token 'export'
.
Removing https://github.com/minichate/ember-cli-conditional-compile/blob/master/index.js#L114-L118 this first part of this if-statement makes the build load. The initializer in included in the production build, but at least it still works.
(Should mention that I also had this similar issue when upgrading to Ember 3.4. But I do recall that ember-cli-conditional-compile
1.1.1
fixed it.)
from ember-cli-conditional-compile.
Update: It seems as though the conditional compiling works if I update route/controller/component in question to an ES6 class 🤔
Is this expected behaviour?
from ember-cli-conditional-compile.
I have found this also.. If I use a version of Ember-cli >= 3.4 then the ember-cli-conditional-compile-features
initialiser gets included in the production output:
...e.default=a})
import Ember from"ember"
var initializer={name:"ember-cli-conditional-compile-features",initialize:function(e){Ember.Logger.info("Initializing feature flags")}},feature_flags=EMBER_CLI_CONDITIONAL_COMPILE_INJECTIONS
Object.keys(feature_flags).map(function(e){window[e]=feature_flags[e]})
export default initializer
define(...
This causes an error Uncaught SyntaxError: Unexpected identifier
.
Also, to add to this, If I use a version of ember-cli-conditional-compile >= 1.1.0, then the enableCompile
property in the ember-cli-conditional-compile/index.js
file is undefined
resulting in the initializer being included in the output with the feature flags baked in. This means the feature flags are also added to the window
object in production.
EDIT: after a bit more investigation, it seems to break at ember cli version >= 3.4.0-beta.2. ...and it works as expected (removes the initialiser) with version <= 3.4.0-beta.1
from ember-cli-conditional-compile.
After lots of debugging last night, I think I found the cause of this error. The way the compiling has been reorganized for Ember 3.4 pushed a lot of code from broccoli/ember-app.js
to broccoli/default-packager.js
and in the process, we ended up with this new processAppAndDependencies method.
What happens there is that applyCustomTransforms
takes the original tree, does some transforms (I think it's mainly there to process AMD modules), whereas processJavaScript
takes the merged tree and does all the pre- and postprocessing (including the part in ember-cli-conditional-compile
that is supposed to remove the module, but also doing the module wrapping), and when the result of those two calls gets merged, as the file is removed, it gets replaced by the unprocessed version of the module - if the module would not be removed, it would (as it's precedence is higher) replace the unprocessed version during the mergeTrees
call.
I think this is an ember-cli bug?
from ember-cli-conditional-compile.
Hi, I encountered the same problem. I opened an issue on ember-cli.
from ember-cli-conditional-compile.
Related Issues (19)
- Ember 4.x compatibility and other fixes HOT 6
- Release or backport ember-cli-babel change? HOT 5
- Can't run production build HOT 2
- {{#if-flags-}} dont always reflect the featureFlags value HOT 5
- Error is thrown when includeDirByFlag is undefined. HOT 2
- camelCased flag doesn't create a helper. HOT 5
- HTMLbars cache isn't busted on rebuilds HOT 5
- Getting undefined error when the value is set to false. HOT 3
- Add `tmp` dir to the .npmignore. HOT 1
- Nice to have: Corresponding {{unless-flag to the {{if-flag HOT 1
- How does this addon differ from https://github.com/jkarsrud/ember-cli-defeatureify? HOT 2
- Transpiler error
- Consider removing "Initializing feature flags" message HOT 1
- Update to use with [email protected] HOT 3
- Doesn't work with ember-cli 1.13.8 HOT 6
- Template Lint and Flags
- Ember 2.x Compatibility Issues HOT 1
- Ember 3.27.0 - Receiving "[BUG] seen set should be available" Error HOT 2
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 ember-cli-conditional-compile.